Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: Pagination – How to remove last page numbers?

@robin-w

Moderator

oh, and I found a bit where we can do some string editing, so…

This code reduces the last to 1 entry, and then looks for that entry and removes it…

add_filter ('bbp_before_paginate_links_parse_args' , 'rew_pagintion' ) ;

function rew_pagintion ($args) {
	$args['end_size'] = 0 ;
return $args;
}

add_filter ('bbp_make_first_page_canonical', 'rew_take_out_last', 10 ,2) ;

function rew_take_out_last ($retval, $pagination_links) {
	$posf = strrpos ($pagination_links, '<a class="page-numbers' ) ;
	$posl = strpos ($pagination_links, '<a class="next page-numbers' ) ;
	$start = substr ($pagination_links, 0 , $posf) ;
	$end = substr ($pagination_links, $posl , strlen($pagination_links)) ;
	$links = $start.$end ;
return $links ;
}

you can get rid of the page number dots using css or some more str functions in the code above, but I’ll leave you to work that out 🙂

Skip to toolbar