How to get and print the most recent excerpt from a specific post in Wordpress
OK, time for a seriously boring post! This one is for you googlers. I’m a noob too sometimes. I had some trouble figuring it out since I hadn’t worked with excerpts before, but had to do it for a client.
How to get and print the most recent excerpt from a specific post in Wordpress:
<?php
$postslist = get_posts(‘category_name=yourcategory&numberposts=1&order=DESC&orderby=date’);
foreach ($postslist as $post) :
setup_postdata($post);
?>
<div id=your_div_id>
<?php the_excerpt(); ?>
</div>
<?php endforeach; ?>
Replace “yourcategory” with the name of the category you want the latest excerpt from (i.e. ‘news’). Rename the div (your_div_id) to anything you want.