Twenty Twelve
[resolved] How to display most recent post with featured image on home page template (2 posts)

  1. flemingworks
    Posted 3 years ago #


    I am using a child theme with twenty twelve and am modifying my front page template file.

    I would like to display:
    the most recent post with its featured image at the top
    and title and content below with a read more link.

    I have been searching online for the right code but have not managed to find it any help on putting this query together would be appreciated!


  2. flemingworks
    Posted 3 years ago #

    I think I figured it out. This code did it for me if anyone has a similar need:

    <?php if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
    <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> <?php the_content() ?> </div>
    <?php endforeach ?>

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic