I have a php function that should print last three posts with title and excerpt.
For the first post printed there is no excerpt.
Here is the code:
$posts = wp_get_recent_posts( array('numberposts' => 3, 'post_status' => 'publish') );
foreach ($posts as $post)
{
setup_postdata($post);
echo "<h2 style='font-size:18px'>".$post['post_title']."</h2>";
if($post['post_excerpt'])
echo $post['post_excerpt']." <a href='".get_permalink($post['ID'])."' style='font-size: 17px;'><b>Continue...</b></a>";
else echo 'no excerpt';
echo "<br><br />";
}
I want to show the excerpt for the first post printed too (the last posted one). What is wrong in my code? Why it's not working for the first post printed?
