1

I used nextpage to separate a post into multiple page and I don't want to show pagination as 1 2 3 Next, I want to to show Prev Next, below is the code I come up with after reading the wp link pages, it is still showing 1 2 3 Next, I don't know what I did wrong, any help will be much appreciated

<?php
wp_link_pages( array( 'before' => '', 'after' => '', 
'previouspagelink'    => '', 'nextpagelink' => '<span>Next</span>', 
'next_or_number' => 'next' ) ); 
?>
1

I'm not sure why it's not working. Did you try with the defaults but only changing the "page" and clearing the before/after?

wp_link_pages( array(
    'before'           => '',
    'after'            => '',
    'link_before'      => '',
    'link_after'       => '',
    'next_or_number'   => 'next',
    'separator'        => ' ',
    'nextpagelink'     => 'Next page',
    'previouspagelink' => 'Previous page',
    'pagelink'         => '%',
    'echo'             => 1
    )
);

Alternatively you could always "hard code" the links to the single.php.

I mean that doesn't really fix you issue, but you know..

<?php global $page, $numpages, $multipage, $more;
if ( $multipage ) {
    if ( $more ) {
        $prev = $page - 1;
        if ( $prev ) {
            $link = _wp_link_page($prev).'Previous page</a>';
            $output .= apply_filters( 'wp_link_pages_link', $link, $prev );
        }
        $next = $page + 1;
        if ( $next <= $numpages ) {
            if ( $prev ) {
                $output .= ' ';
            }
            $link = _wp_link_page($next).'Next page</a>';
            $output .= apply_filters( 'wp_link_pages_link', $link, $next );
        }
    }
echo apply_filters('wp_link_pages', $output);
} ?>

Modified straight from post-template.php/wp_link_pages()

  • your code produced the same result 1 2 3 Next I don't know what is wrong, been searching and testing with different parameters for hours now, no luck – Noob Coder Mar 26 '15 at 20:47
  • It must be some filters in the theme that are overriding this, I will look into it. Thank you. – Noob Coder Mar 26 '15 at 21:04
  • Yeah strange. Just tested myself with <?php wp_link_pages(array('before'=> '', 'after' => '', 'link_before' => '', 'link_after' => '', 'next_or_number' => 'next')); ?> on a test site and it's working fine and not outputting any numbers. – jimihenrik Mar 26 '15 at 21:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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