WordPress.org

Forums

Next page (literally) (23 posts)

  1. unipus
    Member
    Posted 9 years ago #

    Before anyone flames me, I'm not talking about traditional pagination, or listing posts, or anything like that. I am talking about being able to generate links of PAGES (not posts) in sequential order, determined by their Page Order.

    I see there are functions to navigate between posts in chronological order, but I couldn't find anything that does what I'm looking for.

    Any ideas?

  2. Kafkaesqui

    Posted 9 years ago #

    I wrote an experimental plugin for another member's request which links next/previous Pages based on post date. Haven't looked at it in a bit, but should be able to make some mods so one can set links by Page order.

    I'll post a link to the update a little later.

  3. unipus
    Member
    Posted 9 years ago #

    Yeah, I read the other post... that's exactly what I'm looking for (once it's modified of course). thanks, I'll check back soon.

  4. Kafkaesqui

    Posted 9 years ago #

    Took longer than expected as I tried to track down a bug that turned out to be in my Page templates... (Which was good, as it forced me to handle things a bit smarter in the plugin.) Anyway, Next-Previous Page (0.2) supports navigation by Page (menu) order:

    download | view source

    To install, download zip, extract next-previous-page.php to your wp-content/plugins/ directory, and activate Next-Previous Page under Plugins.

    Usage:

    <?php next_page('orderby', 'link', 'before', 'after', 'title_attr'); ?>

    <?php previous_page('orderby', 'link', 'before', 'after', 'title_attr'); ?>

    Parameters:

    orderby:
    Method to order Pages in next/previous link hierarchy. Options are 'post_date' and 'menu_order' (Page order). Default is 'post_date'.

    link:
    Text displayed as the link. Use '%' to display the Page's title as link. Defaults to 'Next Page: %' / 'Previous Page: %'

    before:
    HTML or text to display before the link. There is no default.

    after:
    HTML or text to display after the link. There is no default.

    title_attr:
    Text displayed for the link's title attribute. Use '%' to display the Page's title. Defaults to 'Next Page: %' / 'Previous Page: %'

  5. unipus
    Member
    Posted 9 years ago #

    thanks much, that'll do!

  6. allthewhile
    Member
    Posted 9 years ago #

    This is a great plugin and is almost exactly what I need. Is there a way to exclude it to a parent and it's children or at the very least exclude certain pages?

  7. stelabouras
    Member
    Posted 9 years ago #

    erm..i am searching everywhere but i cannot find where to put the "<?php next_page('orderby', 'link', 'before', 'after', 'title_attr'); ?>

    <?php previous_page('orderby', 'link', 'before', 'after', 'title_attr'); ?>" code...

    In which file exactly ? inside or outside the <div> area?

  8. moshu
    Member
    Posted 9 years ago #

    Obviously, since it is about Pages you should put the code in your default Page template (page.php).
    Which div are you talking about? Sometimes there are dozens...
    I'd suggest, check where the similar code is for the posts - in index.php or single.php and find a placse like that.

  9. stelabouras
    Member
    Posted 9 years ago #

    thanx for the reply...i put the code from "http://codex.wordpress.org/The_Loop_in_Action"
    in theloop.php and everything seems to work normally now :)

  10. moshu
    Member
    Posted 9 years ago #

    Wow, this is the first time I hear about a file called "theloop.php"... but if it works for you, it's fine :)

  11. allthewhile
    Member
    Posted 9 years ago #

    seriously, is there a way to exclude certain pages? I only want it to scroll through certain sub pages not every page. drats!

  12. fuzzimuzzi
    Member
    Posted 9 years ago #

    I gave page A,B,C,D the page order 0,1,2,3. Then I gave page E,F,G,H the same page order: 0,1,2,3. And page F ended having the same "next" and "previous" links as page A...is there some way of getting it to circulate only certain pages?

  13. LiZharD
    Member
    Posted 9 years ago #

    It is possible navigate only child pages? E.g. if i have a Page A with page 1, page 2, page 3 as childs i want browse only this pages.
    Kaf there is a work for you :D

  14. lisamwise
    Member
    Posted 9 years ago #

    I would also like to only navigage throught the child pages. Is this possible?

  15. textfield
    Member
    Posted 8 years ago #

    Moshu, thanks for making this nice plugin for pages. Is there anyway to modify it so one can navigate between brother/sister pages only, specifically excluding their parent and grandparent pages?

  16. moshu
    Member
    Posted 8 years ago #

    1. I've never written a plugin: I am code-illiterate :)
    The plugin above has been made by Kafkaesqui.

  17. textfield
    Member
    Posted 8 years ago #

    Sorry moshu, haste always makes wastes.

    Kafkaesqui, thanks for making this nice plugin for pages. Is there anyway to modify it so one can navigate between brother/sister pages only, specifically excluding their parent and grandparent pages?

  18. Andy Peatling
    Member
    Posted 8 years ago #

    Hi guys, I just modified this plugin so that you can limit it within a specific parent page's children only.

    All you need to do is pass the current page's parent ID into the function as explained below. This will limit the next and previous links to ONLY the brothers and sisters of that current page.

    View Source | Download as Plugin

    The usage is the same as before. Check This post for details. The only difference is an extra parent_id parameter, used as follows:

    <?php next_page('orderby', 'link', 'before', 'after', 'title_attr', $post->post_parent); ?>

    <?php previous_page('orderby', 'link', 'before', 'after', 'title_attr', $post->post_parent); ?>

    I hope this helps the people who were asking for this.

    Andy.

  19. moshu
    Member
    Posted 8 years ago #

    You should make that file a phps or txt - otherwise we cannot see it :)

  20. Andy Peatling
    Member
    Posted 8 years ago #

    Sorry, I was having problems with this. It's done now, although not in color :|

  21. kristjan
    Member
    Posted 8 years ago #

    apeatling

    I've tried to install your revised plugin, but when i try to activate it i get the following error message:

    Parse error: syntax error, unexpected '"', expecting ',' or ';' in ... plugins/next_prev_page.php on line 42

    Line 42 is: echo $before.'<a>ID).'"';

    BUT in the source code you posted above ,
    the same line is: echo $before.'ID).'"';

    I tried simply changing the line in the plugin to the one from the source code but that returned the same error maessage.

    Any ideas?

    kk

  22. Andy Peatling
    Member
    Posted 8 years ago #

    Try downloading again. It seems as though I missed a quote when moving the code into a plugin.

  23. kristjan
    Member
    Posted 8 years ago #

    Thnx, I'll try that

Topic Closed

This topic has been closed to new replies.

About this Topic