WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

I have pagination on my site like this:

Pages 1 2 3 4

… 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

share|improve this question

marked as duplicate by toscho Aug 6 '13 at 8:20

This question was marked as an exact duplicate of an existing question.

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 );  ?>
share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.