Replies: 0
Hi everyone,
Love the Customizr theme. Thanks for all your help.
I am grabbing the 3 most recent posts and displaying them in the sidebar like this:
<div class='text-widget'>
<ul>
<?php echo get_the_post_thumbnail($post['ID'], 'thumbnail'); ?>
<?php
$args = array( 'numberposts' => '3' );
$recent_posts = wp_get_recent_posts( $args );
foreach( $recent_posts as $recent ){
echo '<a href="' . get_permalink($recent["ID"]) . '"><li>' . $recent["post_title"].'</li></a>';
}
?>
</ul>
</div>
I’d like to add a thumbnail image for each post. Possibly using get_the_post_thumbnail? Like this?
<div class='text-widget'>
<ul>
<?php echo get_the_post_thumbnail($post['ID'], 'thumbnail'); ?>
<?php
$args = array( 'numberposts' => '3' );
$recent_posts = wp_get_recent_posts( $args );
foreach( $recent_posts as $recent ){
echo '<a href="' . get_permalink($recent["ID"]) . '"><li>' . $recent["post_title"].'</li>' . get_the_post_thumbnail($post['ID'],'thumbnail');'</a>';
}
?>
</ul>
</div>
Any help is much appreciated. Here’s the site