I've been trying to get the post thumbnail to display in the foreach loop for a few hours now and I can't figure out how to make it work, any help would be greatly appreciated!
<div id="home-posts" class="col-sm-3" role="complementary">
<div class="recent-post-sidebar">
<h3>Popular Posts</h3>
<?php
$popular_post_object = new WDS_JetPack_Popular_Posts( array(
'count' => 5,
'days' => 200,
'transient_affix' => '_mypp')) ;?>
<?php $popular_post_results = $popular_post_object->get_posts();?>
<?php if ( !empty( $popular_post_results ) ) {
foreach( $popular_post_results as $popular_post ) {
echo '<a href="' . $popular_post['permalink'] . '">';
echo '<div class="post one">';
echo '<div class="post overlay"></div>';
echo get_the_post_thumbnail($popular_post->ID, 'wpbs-featured-full');
echo'<h5>'. $popular_post['title'] .'</h5>';
echo '</div>';
echo '</a>';
}
}?>
</div>
</div>
The original source of the code is WebDevStudios.