Jump to content

Recommended Posts

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. 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.

 

The problem can be viewed in this post.

 

 

 

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;
}

Edited by siouxfan45
Link to comment
https://forums.phpfreaks.com/topic/272726-attempting-to-remove-rogue-space/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.