I'm creating my own theme, my little practice. I added the_post_thumbnail
in index.php page. All latest post's featured images are showing on home page except Page featured image
.
While I added the_post_thumbnail
in index.php, I don't understand why the page featured image is not showing up on the home page.
Any suggestions? edited post i think my code not supported page featured image. here's my code
<?php while(have_posts()) : the_post() ?>
<div class="post">
<h2 class="title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<div class="entry">
<a href="<?php the_permalink(); ?>" class="image image-full">
<?php the_post_thumbnail('full'); ?>
</a>
</div>
</div>
<div style="clear: both;"> </div>
<?php endwhile; ?>
the_post_thumbnail
displays the featured image for a given single post. What do you define as the "page featured image"the_post_thumbnail
can be used for page featured image too, but you will need to call it outside of the loop, (this also apply tothe_title()
,the_description()
etc..) In your code you call it in the loop and it will retrieve posts images, call it beforeif( have_posts) {