Plugin Support
ying
(@yingscarlett)
Hi @cgrignon ,
You can try the solution below, but it won’t work for the page number button, it will only work for the previous/next button.
- Add an HTML anchor to the Kadence tab content container, eg.
case-study, press-release , etc. (Not sure if this step would work with the Kadence tab block, you might need to check with their support).
- Add the CSS class to the previous and next buttons of the query loop block, eg.
case-study-paginationfor the case study section, press-release-pagination for the press release section and so on.
- Add this PHP code:
add_filter('generateblocks_dynamic_url_output','custom_query_loop_pagination', 10,2);
function custom_query_loop_pagination($url , $attributes) {
if( ! empty( $url ) && ! empty( $attributes['className'] ) && 'case-study-pagination' === $attributes['className'] ) {
$url = $url.'/#case-study';
}
if( ! empty( $url ) && ! empty( $attributes['className'] ) && 'press-release-pagination' === $attributes['className'] ) {
$url = $url.'/#press-release';
}
if( ! empty( $url ) && ! empty( $attributes['className'] ) && 'blog-pagination' === $attributes['className'] ) {
$url = $url.'/#blog';
}
if( ! empty( $url ) && ! empty( $attributes['className'] ) && 'all-pagination' === $attributes['className'] ) {
$url = $url.'/#all';
}
return $url;
}
Hi @yingscarlett , thank you for your answer!
I tried the code and it almost works. I think now the problem is that the pagination comes before the tab anchor in the url – see screenshot link (only on my staging website at the moment).
So at the moment, when i click on the “next” button, I stay on the right tab, but stay on the first page of the query loop
https://snipboard.io/b6yig0.jpg
Let me know if there is something I can do.
Thank you so much,
Clemence
Plugin Support
ying
(@yingscarlett)
Looking at the screenshot of the URL, it looks right, it shows page2 in the URL.
Any chance I can see the site with the code implanted?
Let me know!
Hi @yingscarlett , I lived the changes so you can investigate the issue, thanks!
Plugin Support
ying
(@yingscarlett)
The query loop pagination doesn’t seem to be working at all, if you disable the PHP code, does the pagination work?
I just tested the same method using GB’s tab block and it works perfectly.
Let me know!
Hmm indeed you are right, I didn’t see that. Do you know what may be causing this issue?
Plugin Support
ying
(@yingscarlett)
I’m not sure, it might be code conflicts between the tabs and the query loop block.
Oh, then can GenerateBlock look into this? I’ll contact Kadence Block regarding this issue as well.
Hi @yingscarlett , I did some debugging on my staging and the issue still happens after deactivating all plugins but GenerateBlocks.
Could it be a conflict with Strattic itself?
Best
Plugin Support
David
(@diggeddy)
Hi there,
paginated Query Loop blocks on a static page rely on URL query strings to update the content. They don’t use /page/2 URLs as a static page does not support that kind of pagination, and you would not be able to add multiple paginated query loops on the same page if that were the case.
And its the same system that WPs core Query Loop block uses. So you can test a core query loop block to see if it has the same issue.
If it does it is probably related to your server if its serving static pages you may need to check with them how to handle this.
Hi David,
Thank you so much for your answer. Indeed I just tested with the WP Query loop block and it’s the same problem. Let me contact Strattic support then.
Cheers
Hi there! We haven’t heard back from you for a while now so we’re going to go ahead and set this topic as resolved. Feel free to reply if you need any more help.