I’m trying to write a custom homepage for my wordpress blog.
I want to show the top 5 posts from three main categories on columns and I managed to do it.
Next to each post link I want to include the post thumbnail but I can’t get it to show. This is the code I’m using:
<?php
$posts = get_posts('numberposts=5&category=86');
foreach($posts as $post) :
setup_postdata($post);
if ( has_post_thumbnail($post->ID) ) {
echo get_the_post_thumbnail( $post->ID,array(100,100));
}
?>
<p>
<a id="post-<?php the_ID(); ?>" href="<?php the_permalink(); ?>">
<?php the_title(); ?></a></p>
<?php endforeach; ?></div>
I verified that each post has a thumbnail and that thumbnails are supported by the theme. However nothing is output by the call to get_the_post_thumbnail.
What am I doing wrong?