WordPress.org

Ready to get started?Download WordPress

Forums

Pagination with Pages (4 posts)

  1. jamesmakeseyes
    Member
    Posted 4 years ago #

    I have a parent page that all of the child pages feed into. I would like to limit it to 10 pages and then add a next/previous link.

    So for example, lets say that I have 30 single pages of content that I show on one single page (see code below) but I would like to limit that to 10 and have 3 pages (previous and next links).

    I'm not sure how to add the links. If anyone could help, that would be awesome.

    Here is my current markup.

    <?php
    // Set up the arguments for retrieving the pages
    $args = array(
    'post_type' => 'page',
    'numberposts' => 1,
    'post_status' => null,
    'post_parent' => $post->ID, // $post->ID gets the ID of the current page
    'order' => ASC,
    'orderby' => title,
    );

    $subpages = get_posts($args);
    // Just another WordPress Loop
    foreach($subpages as $post) :
    setup_postdata($post);
    ?>

    <div class="entry">

    <div class="story fRight">

    <h3><?php the_title(); ?></h3>
    <p><?php $customField = get_post_custom_values("lookExcerpt");if (isset($customField[0])) { echo $customField[0]; } ?></p>

    </div>

    <div class="gallery">
    <?php the_content(); ?>

    </div>

    </div><!-- end .entry -->

    <?php endforeach; ?>

  2. esmi
    Forum Moderator
    Posted 4 years ago #

    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    // Set up the arguments for retrieving the pages
    $args = array(
    'post_type' => 'page',
    'numberposts' => 1,
    'post_status' => null,
    'post_parent' => $post->ID, // $post->ID gets the ID of the current page
    'order' => ASC,
    'orderby' => title,
    'posts_per_page' => 10
    );
  3. jamesmakeseyes
    Member
    Posted 4 years ago #

    that does not seem to be working. I tested it and the navigation buttons are just not showing up. I'm not really sure what the issue is with it. If anyone could help, that would be awesome.

  4. jamesmakeseyes
    Member
    Posted 4 years ago #

    Oh yeah, these are not 'post'. each is a single 'page' that feeds into an 'parent' page.

Topic Closed

This topic has been closed to new replies.

About this Topic