• Hi everyone!

    I’m developing a custom theme for WordPress and got this issue:

    In the header.php I’m using the following code to display the featured image as header image. It works fine for pages and posts.

    <div id="featured-image" style="background-image: url(<?php 
    if ( has_post_thumbnail() ) { 
    	the_post_thumbnail_url('full');
    }                                           
    ?>);">
                    
    </div>

    However on the page, which contains the blogposts (loop), the code above provides the featured image from the last post, although the featured image from the page itself should be displayed.

    Could you please help me?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Featured image on posts page shows image from last post.’ is closed to new replies.