0

Added this function in any page:

get_template_part('recent', 'posts');

And:

if(have_posts()){
while(have_posts()){ the_post(); ?>
    <div class="site-content clearfix"><?php the_content(); ?></div>
<?php }
}

It's working, show 5 blog post on my page. But it's have only title and publish date. I want add thumbnail images on this post.

How can I do it?

  • 2
    What have you tried? So far you're showing us a template part and my answer would be: Go, read up in Codex about template tags and thumbnails/featured images. – kaiser Nov 27 '13 at 22:23
1

You can get the post thumbnail by using get_the_post_thumbnail():

 echo get_the_post_thumbnail( $page->ID, 'thumbnail' );
  • 1
    Or just use the_post_thumbnail() which is almost the same thing, but it echoes the thumbnail HTML code instead of returning it. – Krzysiek Dróżdż Nov 28 '13 at 9:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.