John Davidson

javascript - having a trouble numbering in wordpress pages

0 comments
Message:


Hi there I use this function for numbering pagination on wordepress.


function numbering_pagination() {
global $wp_query;
$all_pages = $wp_query->max_num_pages;
$current_page = max(1, get_query_var('paged'));
if ($all_pages > 1) {
return paginate_links(array(
'base' => get_pagenum_link() . '%_%',
'format' => '?paged=%#%',
'current' => $current_page,
'mid_size' => 1,
'max_size' => 1,
'type' => 'list',
'next_text' => __('next'),
'prev_text' => __('prev')
));
}
}

and is Work well with (index, category). but in page search, the permalink show like this when I click next button.first ckick like this.


 exmp.com/?s?paged=2

secend click.


exmp.com/?s?paged=2?paged=2

PLZ enyone HElp



My Answer:
It looks like there may be a typo in your code that is causing the issue with the pagination links on the search page.

In your 'base' parameter, you have a typo in the concatenation operator. It should be '.' instead of '.%_%'.

Try updating your 'base' parameter to the following:

'base' => get_pagenum_link() . '?%_%',

This should fix the issue with the pagination links on the search page. Let me know if this helps!

Rate this post

4 of 5 based on 3046 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us