large shade tree



Recent Posts

Shade Tree Sites |Building Better Websites

How to Display a List of Recently Updated Posts

Have been frustrated using just the recent posts widget – many times I update older posts with new information and wanted to be able to alert visitors to these updates – found this little piece of code and it does the job. 

Change the number of posts to show to suit your purpose.

<?phpget_results(“SELECT ID, post_title FROM $wpdb->posts WHERE post_status = ‘publish’ AND post_modified_gmt < ‘$today’ ORDER BY post_modified_gmt DESC LIMIT $number”)):

$today = current_time(‘mysql’, 1);
$number = 5; // number of posts

if($recentposts = $wpdb->


<h2><?php _e(“Recently Updated”); ?></h2>
<?phppost_title == ”) $post->post_title = sprintf(__(‘Post #%s’), $post->ID);
echo ‘<li><a href=”‘.get_permalink($post->ID).'”>’.the_title().’</a></li>‘;

foreach($recentposts as $post) {


} ?>

<?php endif; ?>