WordPress.org

Ready to get started?Download WordPress

Forums

Link to next page when using <nextpage> tag (2 posts)

  1. wi_engineer
    Member
    Posted 5 years ago #

    Hello,

    A client is using <!-- nextpage --> to split up a post into multiple pages. She's asked if there's a way to reference the next page. That is, in addition to the "Pages 1 | 2 | 3 " that is added, she wants a link that says "<Post Title> Continued here..."

    So, is there any way to add to a post something like:

    <a href="(php tag to next page of the post)">(php tag to post title) Continued here... </a>

    that would be typed in when a post is created in the dashboard?

    Thanks,
    Jason

  2. rkgneuschul
    Member
    Posted 4 years ago #

    There's no automatic way to add such a link as far as I know; however you could construct a code snippet for her to use as part of a copy/paste/edit process - provided she's organised enough and disciplined enough to edit it correctly.

    The generic format for such a page link is

    <a href='http://bloginfo('url')/?page_ID=N&page=n'>your tag link</a>

    where

    bloginfo('url') is the root URL of the site

    N is the unique ID for the root page that holds the nextpage links

    n is the number of the required subpage [each nextpage break creates a new subpage]. The root page itself always has a subpage number of 1, so all subsequent sub-pages number from 2 upwards: you may need to know that to construct previous/next links correctly. In other words the root page would always be

    <a href='http://bloginfo('url')/?page_ID=N&page=1'>your tag link</a>

    You can extract the ID of a current root page with code using get_the_ID(); and the number of subpages in it using echo $numpages; or print_r $numpages; etc.

    Hope this helps.

Topic Closed

This topic has been closed to new replies.

About this Topic