Jump to content


Photo

Attempting to Remove Rogue Space

wordpress filter

  • Please log in to reply
No replies to this topic

#1 siouxfan45

siouxfan45

    Newbie

  • New Members
  • Pip
  • 1 posts

Posted 05 January 2013 - 08:54 AM

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, 05 January 2013 - 08:55 AM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com