• I’m setting up a WordPress powered site that is less of a blog and more of a page driven site.

    I want to have a list in the sidebar of the five most recently added pages.

    I’ve no problem displaying a list of latest posts, but how do I go about listing the newest pages added to the site?

Viewing 1 replies (of 1 total)
  • Try this in your sidebar. You could also put this in a php code widget.

    <?php
       $args=array(
       'showposts'=>5,
       'post_type' => 'page',
       'caller_get_posts'=>1
       );
    $my_query = new WP_Query($args);
    if( $my_query->have_posts() ) {
      while ($my_query->have_posts()) : $my_query->the_post(); ?>
        <p><small><?php the_time('m.d.y') ?></small> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
        <?php
      endwhile;
    }
    ?>
Viewing 1 replies (of 1 total)
  • The topic ‘How to display most recent pages, not posts.’ is closed to new replies.