Wordpress recently updated pages or posts
Here is some code I hacked together to display a list of recently updated pages and posts on a Wordpress site:
<?php
$today = current_time('mysql', 1);
$howMany = 18;
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")):
?>
<h2><?php _e("Recent Updates"); ?></h2>
<ul>
<?php
foreach ($recentposts as $post) {
if ($post->post_title == '') $post->post_title = sprintf(__('Post #%s'), $post->ID);
echo "<li><a href='".get_permalink($post->ID)."'>";
the_title();
echo '</a></li>';
}
?>
</ul>
<?php endif; ?>
The variable $howMany holds the number of items to display in the list. I used some code I found in a Wordpress theme I am using on some website, and modified it to help someone in need of this specific solution.
Update: I just added this code to the bottom of this website and configured it to show only five items.


[...] goes to Corey for this awesome [...]