I need the pagination liks to have the url, like:
current_url?p-page=1
current_url?p-page=2
current_url?p-page=3
And so.. The reason I need this is because I have other params in the page.
the problem is that in the docs, it specs:
format
(string) (optional) Used for Pagination structure. The default value is '?page=%#%', If using pretty permalinks this would be '/page/%#%', where the '%#%' is replaced by the page number. Default: '?page=%#%'
And I have friendly url enabled,
How can I prevent the default ( BTW it ignores my p-page
, still using page
)
current_url/page/1
current_url/page/2
current_url/page/3
this is my code, right now:
echo paginate_links( array(
'base' => str_replace( 999999999, '%#%', esc_url( get_pagenum_link( 999999999 ) ) ),
'total' => $query->max_num_pages,
'current' => max( 1, get_query_var( 'p-page' ) ),
'format' => '?p-page=%#%',
'show_all' => false,
'type' => 'plain',
'end_size' => 2,
'mid_size' => 1,
'prev_next' => true,
'prev_text' => sprintf( '<i></i> %1$s', '<i class="icon-chevron-left"></i>' ),
'next_text' => sprintf( '%1$s <i></i>', '<i class="icon-chevron-right"></i>' ),
'add_args' => false,
'add_fragment' => '',
) );
As a temporary solution I'm doing it like this:
if ($current_page > 1) {
echo '<a href="?p-page='.($current_page-1).'" class="page-numbers prev"><i class="icon-chevron-left"></i></a>';
}
for ($i = 1; $i <= $query->max_num_pages; $i++) {
echo '<a href="?p-page='.$i.'" class="page-numbers '.($current_page == $i ? 'current' : '').'">'.$i.'</a>';
}
if ($current_page < $query->max_num_pages) {
echo '<a href="?p-page='.($current_page+1).'" class="page-numbers prev"><i class="icon-chevron-right"></i></a>';
}
But would be great to take advantage of the dots functionality and so.. any idea?