Home › Forums › Support › Featured image on single post as div background. › Reply To: Featured image on single post as div background.
November 12, 2016 at 1:11 am
#243716
Wim
Hi Tom, thanks for replying.
I followed the demo on http://demos.wpclips.net/templates/genesis-bg-featured-img-fx/ and found a solution.
Just hook a div for the image in the wp_head, css add the featured image to it, flip and blur.
For those who are looking for something similar, here is the code. Don’t forget to execute php.
<?php
$thumb = wp_get_attachment_image_src( get_post_thumbnail_id( get_the_ID() ), 'full' );
if ( $thumb && is_single() ) {
?>
<div class="bg-featured-image"></div>
<style type="text/css">
.bg-featured-image {
background-image: url('<?php echo $thumb['0'];?> ');
background-attachment: fixed;
background-size: cover;
height: 100%;
position: fixed;
width: 100%;
z-index: -99;
-webkit-filter: blur(10px) brightness(110%);
filter: blur(10px) brightness(110%);
-ms-transform: scale(-1.1,1.1);
-webkit-transform: scale(-1.1,1.1);
transform: scale(-1.1,1.1);
margin: 0px;
}
</style>
<?php
}
?>