WordPress.org

Support

Support » Themes and Templates » [Resolved] How to display most recent post with featured image on home page template

[Resolved] How to display most recent post with featured image on home page template

  • Hi,

    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!

    Thanks!

Viewing 1 replies (of 1 total)
  • 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.
      					the_post_thumbnail();
    					}
    					?>
    <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> <?php the_content() ?> </div>
    <?php endforeach ?>
Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] How to display most recent post with featured image on home page template’ is closed to new replies.