Thread Starter
awelsh
(@awelsh)
Hi Shazzad,
Have you been able to replicate the issue I reported a week ago? Is your plugin compatible with a multisite?
Thanks,
Adrian
Thread Starter
awelsh
(@awelsh)
Ok, I’m in the process of trying to debug this problem since I haven’t heard back from anyone. When I list a page for the first time, the paginate_links() returns the following (ps. I’ve also added the $base, $paged and $max_num_pages variables to the error log):
[16-Feb-2015 22:38:32 UTC] base = ?page16=%#%
[16-Feb-2015 22:38:32 UTC] paged = 1
[16-Feb-2015 22:38:32 UTC] max_num_pages = 7
[16-Feb-2015 22:38:32 UTC] <span class='page-numbers current'>1</span>
<a href='?page16=2'>2</a>
<a href='?page16=3'>3</a>
<span class="page-numbers dots">β¦</span>
<a href='?page16=6'>6</a>
<a href='?page16=7'>7</a>
<a href="?page16=2">Next</a>
Now when I click on page 2 link, paginate_links() lists the following:
16-Feb-2015 22:38:44 UTC] base = ?page16=%#%
[16-Feb-2015 22:38:44 UTC] paged = 2
[16-Feb-2015 22:38:44 UTC] max_num_pages = 7
[16-Feb-2015 22:38:44 UTC] <a href="?page16=2">Previous</a>
<a href='?page16=2'>1</a>
<span class='page-numbers current'>2</span>
<a href='?page16=2'>3</a>
<a href='?page16=2'>4</a>
<span class="page-numbers dots">β¦</span>
<a href='?page16=2'>6</a>
<a href='?page16=2'>7</a>
<a href="?page16=2">Next</a>
As you can see, the links for all pages are 2 and this is why I can’t get past the second page. If I click on page 4 to start with instead of 2, then all the links returned are 4.
I’m not sure if this is an issue with your plugin or with wordpress. As I said in my first post, the problem doesn’t seem to exist if I run a single site instead of a multisite.
Hi Adrian, please send me a link of the site you are testing this. Thanks.
Thread Starter
awelsh
(@awelsh)
Hi, Shazzad,
Thanks for getting back to me. Unfortunately my site is only running on localhost at the moment.
I managed to trace the issue to the following in wordpress’s general-template.php, around line 2680.
if ( $add_args )
$link = add_query_arg( $add_args, $link );
$link .= $args['add_fragment'];
It is changing the correct links with the $add_args array. WordPress generates this array by the ?page16=3 in the url.
I think what you need to do is add an empty ‘add_args’ to the array (see below in your code from the navigation() function ) you send paginate_links. This will then stop wordpress adding its default.
$return = paginate_links( array(
'type' => $nav_type,
'base' => $base,
'format' => $base,
'current' => $paged,
'total' => $max_num_pages,
'end_size' => 2,
'mid_size' => 2,
'prev_text' => $prev_text,
'next_text' => $next_text,
'add_args' => ''
));
When I do this, my problem is solved!
Thanks for your help.
Awesome, you did it π I will update the plugin with your code. Thanks.
Thread Starter
awelsh
(@awelsh)
Thanks Shazzad,
This problem has been bothering me for a few weeks. I tried looking for another plugin, but couldn’t find anything as good as yours, so I just spent a few hours isolating the issue.
I’m not sure why this problem didn’t arise on a single site compared with multisite. I can’t see anything there that would make a difference.
Anyway, I’m glad the issue is fixed.
Regards,
Adrian
Ok, there’s another fact.
You possibly know that, with our plugin, we can place multiple list having pagination on the same page. And, all of the list does have appropriate pagination. But when we set the add_args to empty, only one list pagination works and rest of them starts from first page.
I think that i will only be applying the add_args for multisite install.
Thanks.
Thread Starter
awelsh
(@awelsh)
I currently have one page where I have four lists with pagination and ajax=1 and have no issues with the add_args = ” All lists behave correctly and don’t lose their position as I navigate through them.
With a page that has multiple lists with pagination and ajax=0, when the page reloads when clicking a pagination link, the other lists loose their position and reset to 1. Is this what you are talking about? If so, I don’t see that an issue since the page has reloaded.
Adrian
I have similar issues and have absolutely no clue, whats wrong…
I have ajax navigation enabled and would like to navigate through the posts. First and second page work as expected. Third page gets displayed but doesn’t change the navigation on the bottom anymore (still marked to be on 2nd page) and somewhen (5th page or so) navigating won’t work anymore.
I’m willing to share access to the page and give out the link to get this solved… (I’m even willing to pay you a beer or two π )
[edit]Forgot to mention that this happens on a normal standard wordpress installation with a single list in a normal post. And: it’s a bit urgent… π [/edit]
Kind Regards
flipcharter