WordPress.org

Support

Support » How-To and Troubleshooting » Include page number on paginated posts.

Include page number on paginated posts.

  • 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.

Viewing 4 replies - 1 through 4 (of 4 total)
  • 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.

    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.

    Moderator Michael

    @alchymyth

    Forum Moderator

    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 } ?>

    Excellent. Job done.
    Thanks very much.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Include page number on paginated posts.’ is closed to new replies.