Support » Plugins » Pagination with Pages

  • jamesmakeseyes

    (@jamesmakeseyes)


    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; ?>

Viewing 3 replies - 1 through 3 (of 3 total)
  • esmi

    (@esmi)

    Forum Moderator

    $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
    );
    jamesmakeseyes

    (@jamesmakeseyes)

    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.

    jamesmakeseyes

    (@jamesmakeseyes)

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

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Pagination with Pages’ is closed to new replies.