• I wanted to list the latest 10 pages created without hierachical order.

    I tried wp_list_pages with “number=10&depth=0&sort_column=post_date”.
    All I got was a complete list of all pages.

    Any suggestions?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Assuming that you want to do this outsdie The Loop, try:

    <?php
    $latest_pages = get_posts('post_type=page&orderby=date&numberposts=10');
    if($latest_pages) echo "<ul>\n";
    foreach($latest_pages as $post) :
    	setup_postdata($post);
    	?>
    	<li><a href="<?php the_permalink();?>"><?php the_title();?></a></li>
    <?php endforeach;
    if($latest_pages) echo "\n<ul>\n";
    ?>
    Thread Starter marcc1

    (@marcc1)

    Perfect!

    Thanks!!!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to list latest pages?’ is closed to new replies.