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

I'm using a code called custom_link_pages to generate my multiple page post links, but I'm getting a space between my page numbers and previous link, but my next link is missing the same space. These need to be spaced equally so I would like to either add the necessary space or remove all spaces.

For reference to what I'm talking about, view line 281 at: http://themeforward.com/demo2/?p=1813&page=2

I am assuming this could be from the custom code in my functions:

    // Custom Next/Previous Page
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;

How I grab that code:

    'before' => '<div class="pagelinks">' . __(''),
    'after' => '</div>',
    'next_or_number' => 'next_and_number', # activate parameter overloading
    'nextpagelink' => __('Next'),
    'previouspagelink' => __('Previous'),
    'pagelink' => '%',
    'echo' => 1 )
share|improve this question
What is this __('') thingy? – toscho Jan 25 '12 at 9:03
@toscho it's for localization. – BandonRandon Jan 25 '12 at 9:05
@BandonRandon A localized space? Really? ;) – toscho Jan 25 '12 at 9:06
@toscho, Apparently, I don't see no harm in it. That would allow for removal or addition of space using a translation file. – BandonRandon Jan 25 '12 at 9:09
Without context it is problably one of the worst strings to translate ever. Plus, there are not that much different spaces in different languages. – toscho Jan 25 '12 at 9:14
up vote 2 down vote accepted

This may sound stupid but why not just add the space in your function? There are several places to do it:

'nextpagelink' => __(' Next')

$args['link_before'] .' '. $args['nextpagelink'] . $args['link_after'] . '</a>'

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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