I’ve got this line of code –
<?php the_post_thumbnail('latest-img'); ?>
which is pulling in the correct featured image, however when I try and put –
<div class="blog-image" style="background:url('<?php the_post_thumbnail('latest-img'); ?>');"></div>
it doesn’t show.
Does anyone know what I’m doing wrong?
You need to get ID of the post, then get thumbnail ID of the post and use it to get URL of the thumbnail:
then include URL of image in style of div: