Display Recently Updated Posts & Pages in Wordpress
Posted: February 3rd, 2009 | Filed under: Wordpress Hacks | Tags: code snippet, wordpress, wordpress code, Wordpress Hacks, wordpress how to![]()
$today = current_time('mysql', 1);
$howMany = 5; //Number of posts you want to display
if ( $recentposts = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_status = 'publish' AND post_modified_gmt < '$today' ORDER BY post_modified_gmt DESC LIMIT $howMany")):
?>
-
foreach ($recentposts as $post) {
- ";
the_title();
echo '
if ($post->post_title == '') $post->post_title = sprintf(__('Post #%s'), $post->ID);
echo "
';
}
?>

Leave a Reply
You must be logged in to post a comment.