WordPress.org

Ready to get started?Download WordPress

Forums

Pagination on PAGES (not posts) (7 posts)

  1. jinabolton
    Member
    Posted 5 years ago #

    Hi. I have a documentation website that we are treating like a book (Chapters and pages within those chapters). So we are using pages instead of posts, so that we can take advantage of the hierarchy structure of pages, rather than a chronological structure that posts have.

    We create a page that acts as a "chapter", and then we create subpages within those "chapters". Some subpages have their own subpages (so there are grandchildren as well). Any page that has children displays a list of those children (and grandchildren) — but not siblings pages or higher-level pages.

    Right now, the only way to go from a (sub)page to the next (sub)page is to climb back up to the parent, and select it from there. This is fine, but we'd like to include an easier way to go from page to page (siblings). What we are hoping to get is pagination (like posts have) that allow you to go to next and previous (sibling) pages. This will allow the site to behave more like a book.

    We don't want to list out all the pages to the site because it clutters up the layout (there are a TON of pages), and even just showing direct siblings (from the parent's children) is still a lot of clutter.

    Part of me is thinking maybe it would have been better to have gone to posts, but then that wouldn't have the hierarchy structure we want. Plus at this point, we've gone too far to go back now. :)

    So my question is, how do I do this? Will it require a plugin? If so, does one exist? I have no PHP skills, so I rely heavily on what I can find online. Unfortunately, this is one thing I've not been able to find.

    Any help would be sooooo appreciated! :)

  2. mrlarter
    Member
    Posted 5 years ago #

    I suspect you are looking for something along these lines?

    http://codex.wordpress.org/wp_list_pages

  3. jinabolton
    Member
    Posted 5 years ago #

    That's the list of pages. I need next/previous links. :)

  4. jinabolton
    Member
    Posted 5 years ago #

    I'm guessing this is not possible? Every response I'm getting on Twitter (I asked there as well) seems to point to no.

  5. MichaelH
    Member
    Posted 5 years ago #

    I looked for a plugin and didn't see much either. Of course you could always put a link to a previous and next page in each of your pages, or, as mrlarter suggested, use wp_list_pages to display all the pages that are children of your parent page.

  6. Hafiz Rahman
    Member
    Posted 5 years ago #

    Jina,
    this plugin http://wordpress.org/extend/plugins/multi-page-toolkit/ might be able to do what you're looking for. But it requires all your "subpages" to be placed within a single Page (instead of within separate Pages like you have now), and then you split them with the <--nextpage--> Quicktag.

  7. stevecoy
    Member
    Posted 4 years ago #

    I'm trying to do a similar thing (I think). Basically, what I want to do is create a next_post_link, but for WP Pages. Let's say this is my page hierarchy:

    Page A
    Page B
    Page C

    While I'm viewing Page A, I want to display a link and a preview image of Page B. While viewing Page B, I want to view the same for Page C, and so on down the line.

    Here's my code so far:

    <?php
    global $post;
    $currentpage = get_the_ID();
    $parent = $post->post_parent;
    $args=array(
    'post_type'=>'page',						'post__not_in'=>array($currentpage),				'post_parent' => $parent,
    'orderby' => 'title',
    'order' => 'ASC',
    'showposts' => 1,
    );
    
    $siblings = new WP_Query($args);
    ?>
    <div class="next-page">
    <?php while ($siblings->have_posts()) : $siblings->the_post(); ?>
    <!--do some stuff-->
    <?php endwhile ;?>

    What I'm missing is some sort of offset, or "start" parameter, so that it only return the immediate sibling of the current page.

    I appreciate any help. Thanks.

    By the way, I have been trying to post this as a new topic for weeks, but it looks like the forum is not letting me post a new topic. When I log out, the the thread is no longer visible, and I can't add it to my favorites RSS feed. Does this happen to anyone else? Do I need special powers to be able to create a new thread?

Topic Closed

This topic has been closed to new replies.

About this Topic