Forums

next and previous PAGE link (10 posts)

  1. triggame
    Member
    Posted 2 years ago #

    Does anyone know if there is a way to display a next page link below pages to follow the order of the page navigation menu.

    Please, would really appreciate any insight into how to do this.

    ...oh, and please note I'm NOT referring to POSTS! I do know about the "next_post_link" template tag for posts.

    Thanks.

  2. dor
    Member
    Posted 2 years ago #

    Well... What is a "next page"? Regarding to posts this has chronological meaning...

    So, can you tell what is "next page"... for you?-)

  3. triggame
    Member
    Posted 2 years ago #

    Well, yeah, but I want one that goes through the list of pages not posts.
    I suppose it would be more like the next_posts_link for single posts. But I want one for the page template which only shows a single page and not a single post or multiple posts.

    ...something that will go to the next one in the list produced by this template tag: wp_list_pages

  4. dor
    Member
    Posted 2 years ago #

    What is list of pages? How you suppose them to be ordered?

  5. triggame
    Member
    Posted 2 years ago #

    wp_list_pages
    ...you order them in wordpress admin

  6. dor
    Member
    Posted 2 years ago #

    Well, yes, i would say you need your own query and the Loop...

    But because of you talk about a single page --- you need your own function to get your prev. and/or next page... in order you defined.

    So, i believe, you need your own function.

  7. triggame
    Member
    Posted 2 years ago #

    hmmm... you know how to do that?
    Sorry, I'm not that clever. Wouldn't know where to start in achieving it, besides reading through the php.net website! I'm not a php programmer as you may have noticed.
    ...thanks for you speedy responses Dor. Really appreciate it.

  8. dor
    Member
    Posted 2 years ago #

    Well... Whether you've noticed it or not --- i'm not a programmer at all :-(

    :-) Honest.

    I guess you need to have page id... Probably then i would try with SQL query like that (not a real query! in meta-language, let's say):

    SELECT id, title WHERE post_type = "page" and id > this_page_id LIMIT 1;

    (you'll need to check some things before trying this for real)

    This will give you id an title for "next" (by id) page...

    This is a wild guess.

    Most probably i would first try this with wp_query, not 'raw' SQL query...

    Hope this helps... And hope somebody else helps too.

  9. triggame
    Member
    Posted 2 years ago #

    WOW! SQL query!!! ...well, I can barely read what is happening in php. No idea about SQL queries. I must learn though.
    Yeah, i think the query_posts might would have been cool if you can limit it to pages and then maybe the next previous, thing could kick in.
    ...I'll check here every now and then to see if there is a response.

  10. dor
    Member
    Posted 2 years ago #

    Great, you've read my answer, so now i will blame myself :)

    The point is that you hardly need to get "next by ID" --- if you have you pages structured, you need "next in structure".

    So, you can take a look at wp-includes/post-template.php --- how wp_list_pages() does this.

    Well, it uses Walker_Class, not sure if this can help you.

    Sorry for the noise.

Topic Closed

This topic has been closed to new replies.

About this Topic