• Resolved Tupelo

    (@tupelo)


    With the list pages command, is it possible to specify to list only the pages created before the current one?

    Example:

    When on page 3, the list pages command would show only page 1 and page 2.

    When on page 4, the list pages command would show only page 1 and page 2 and page 3.

    When on page 9, the list pages command would show pages 1 through 8.

    And so on.

    Thank you.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Try this in your Page Template:

    <?php
    //display pages with ID less than current page
    if ( is_page() ) {
      $pages = get_pages();
      foreach($pages as $page) {
        if ($page->ID < $posts[0]->ID ) {
        ?>
          <p><a href="<?php echo get_page_link($page->ID) ?>"><?php echo $page->post_title ?></a></p>
        <?php
        }
      }
    }
    ?>
    Thread Starter Tupelo

    (@tupelo)

    Thanks Michael.
    I will try it as soon as I can, and let you know.
    I appreciate the quick reply.
    tupelo

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘List only previous pages?’ is closed to new replies.