Show most recently updated pages
-
Heyy…I was looking at the codex here and found out how to display pages according to the date/id but the thing I’m trying to do is limit it to showing the 5 latest ones – just like the recent posts tag:
<?php $how_many=5; //How many posts do you want to show require_once('wp-config.php'); // Change this for your path to wp-config.php file ?> <ul class="main"> <? $news=$wpdb->get_results("SELECT <code>ID</code>,<code>post_title</code> FROM $wpdb->posts WHERE <code>post_type</code>=\"post\" AND <code>post_status</code>=\"publish\" ORDER BY post_date DESC LIMIT $how_many"); foreach($news as $np){ printf ("<li><a href=\"index.php?p=%s\">%s</a></li>", $np->ID,$np->post_title); }?>
So I guess my question is…is it possible to display a list of recent pages like above (sorted with the latest to be updated at the top)?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Show most recently updated pages’ is closed to new replies.