WordPress.org

Ready to get started?Download WordPress

Forums

Include page number on paginated posts. (5 posts)

  1. gulliver
    Member
    Posted 1 year ago #

    I sometimes have long posts which I paginate using <?php wp_link_pages( $args ); ?> to insert links at the foot of each page of the post.

    I also want to include a 'continued' on pages other than the first, but have no idea how to do this.

  2. Mohamad Hanafi
    Member
    Posted 1 year ago #

    Hi, gulliver.

    I found this

    page - <!--nextpage--> WordPress tag similar to the more tag, except it can be used any number of times in a post, and each insert will "break" and paginate the post at that location. Hyperlinks to the paginated sections of the post are then generated in combination with the wp_link_pages() or link_pages() template tag.

    Details here.

    Thanks,

    Hanafi.

  3. gulliver
    Member
    Posted 1 year ago #

    Thanks.

    Maybe I didn't explain myself properly... I use that tag already; what I want to be able to do is to include a 'continued' on pages other than the first.

  4. alchymyth
    Forum Moderator
    Posted 1 year ago #

    the paginated page and total number of sub pages are in global variables; (this is the same for pages or posts)

    possibly add some code into the loop of single.php (for posts) or page.php (for pages) - example code:

    <?php global $page; global $numpages; if( $numpages > 1 && $page > 1 ) { ?>
    <div class="continued">continued ... <?php echo '(' . $page . ' of ' . $numpages . ')'; ?> </div>
    <?php } ?>
  5. gulliver
    Member
    Posted 1 year ago #

    Excellent. Job done.
    Thanks very much.

Topic Closed

This topic has been closed to new replies.

About this Topic