I have a custom filter for WordPress' wp_link_pages which allows both next/previous links and pagination to be used. However, I have an extra linked space in front of 'Next page' I can't seem to get rid of, at least, properly. I need to maintain the spacing while de-linking the extra space in front of "Next page". I was able to figure out how to remove the space itself, but I really just need to remove the linking from the space.

You can view the problem here.

add_filter('wp_link_pages_args', 'wp_link_pages_args_prevnext_add');

/*** Add prev and next links to a numbered link list  */
function wp_link_pages_args_prevnext_add($args)
  global $page, $numpages, $more, $pagenow;

    if (!$args['next_or_number'] == 'next_and_number')
        return $args; # exit early

    $args['next_or_number'] = 'number'; # keep numbering for the main part
if (!$more)
        return $args; # exit early

    if($page-1) # there is a previous page
        $args['before'] .= _wp_link_page($page-1)
        . $args['link_before']. $args['previouspagelink'] . $args['link_after'] . '</a>'

    if ($page<$numpages) # there is a next page
        $args['after'] = _wp_link_page($page+1)
        .' '. $args['link_before'] . $args['nextpagelink'] . $args['link_after'] . '</a>'
        . $args['after']
    return $args;

asked 05 Jan '13, 10:18

siouxfan45's gravatar image

accept rate: 0%

closed 06 Jan '13, 15:52

Jeen%20Broekstra's gravatar image

Jeen Broekstra ♦


I'm not sure what this question has to do with the Semantic Web?

(05 Jan '13, 10:36) njh njh's gravatar image

The question has been closed for the following reason "Question is off-topic or not relevant" by Jeen Broekstra 06 Jan '13, 15:52

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 05 Jan '13, 10:18

question was seen: 697 times

last updated: 06 Jan '13, 15:52