Recently Updated Pages

There is an easier way of showing your updates using WordPress instead of typing them in manually. By adding this code, it will display your recently updated posts and pages automatically

1. Add this code where you want your recently updated pages to appear

<?php
$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")):
?>
<h2><?php _e("Recently Updated"); ?></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; ?>

2. The code can be edited now to how you wish. The number 5 in bold is the number of posts/pages you’ve recently updated, you can change this to as many as you wish.
You can also change the h2 heading to a different one. Your updated pages also don’t need to be displayed in a bulleted list. You can remove the ul and li and simply put a

 <br/>

after them.