Home › Forums › Support › Featured image on single post as div background. › Reply To: Featured image on single post as div background.
June 10, 2016 at 11:43 pm
#200987
Tom
Lead Developer
Lead Developer
Something like this might help: http://wordpress.stackexchange.com/questions/115954/featured-image-as-background-image-on-pages
So you could write some CSS in the wp_head hook in GP Hooks like this:
<?php
$thumb = wp_get_attachment_image_src( get_post_thumbnail_id( get_the_ID() ), 'full' );
if ( $thumb && is_single() ) {
?>
<style>
.whatever-element {
background-image: url( $thumb );
}
</style>
<?php
}
?>
Make sure you check the “Execute PHP” checkbox.