Prev and Next link for splitting single post into multiple pages

I have pagination on my site like this:

Pages 1 2 3 4

Read More

… and so on. I am doing this by adding <--nextpage--> where i want to split my long pages into multiple pages.

I want to add previous and next links to the page numbers that looks like this:

Prev 1 2 3 4 5 6 7 Next

Related posts

1 comment

  1. Check out the wp_link_pages function

    <?php $args = array(
        'before'           => '<p>' . __('Pages:'),
        'after'            => '</p>',
        'link_before'      => '',
        'link_after'       => '',
        'next_or_number'   => 'number',
        'nextpagelink'     => __('Next page'),
        'previouspagelink' => __('Previous page'),
        'pagelink'         => '%',
        'echo'             => 1
    );
    
    wp_link_pages( $args );  ?>
    

Comments are closed.