-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Query pagination doesn't work when inside a template part. #38684
Comments
I have come across this pagination problem in WP 5.9 (so core rather than Gutenberg plugin?). My set-up is:
Pagination block in template partIf I choose code reuse over minimising nesting, I put my pagination block in a template part. This results in links such as Exampletemplates/index.html
parts/navigation-loop.html
parts/article-loop.html
Resulting HTML for pagination block
These links don't work. Notice that:
Pagination block in templateIf I choose minimising nesting over code reuse, I put the pagination block in a template. This results in such links as Exampletemplates/index.html
parts/article-loop.html
Resulting HTML for pagination block
These links do work. Notice that:
|
…template. The Query Pagination (QP) block was in a template part so it could be reused, resulting in an extra nested layer. However, due to a bug in WP, it can only be used in templates. This reduces the nesting, but results in duplication of code instead of reuse. Details of the bug: WordPress/gutenberg#38684
I bumped into this too. The issue seems to be that, when in a template part or in a pattern, the pagination doesn't inherit the query context. Basically the condition below is never met, while it should
|
Adding for now to the phase 2 board as this is the closest issue I could find related to the following feedback pulled from #48443
|
Description
When the query pagination block is inside a template block it doesn't go to the next page anymore.
Step-by-step reproduction instructions
To reproduce, use this PR: WordPress/theme-experiments#302
Screenshots, screen recording, code snippet
No response
Environment info
No response
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: