-
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
Allow placing Query pagination inside groups and other containers #58602
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core SVNIf you're a Core Committer, use this list when committing to
GitHub Merge commitsIf you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
If possible I would like this to be part of 17.7 / 6.5 to make it easier to add translations to Twenty Twenty-Three: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change looks good to me 👍
Thank you. |
Upon re-resting, this does not solve the problem with placing the query pagination in a pattern or template part, the path to page/2/ is still incorrect. |
Without this PR; it is possible to: |
What?
The query pagination block has a
parent
attribute in block.json which limits its placement to be a direct child of the query loop.This PR changes parent to ancestor so that the query pagination works when placed in:
Partial fix for #38684
Ideally, it should also be possible to insert or move the query pagination block to a template part, when that template part is placed inside the query loop, this PR does not solve that.
Why?
Because it is limited to be placed directly in the query loop, it limits its design choices, but it also makes translating the labels more difficult.
To make these labels translatable, you would have to place the whole query inside a block pattern:
How?
In block.json, parent is changed to ancestor.
Testing Instructions
On your WordPress installation, make sure that you have enough posts to enable pagination on archives.
Download and install Twenty Twenty-Three.
In the themes patterns folder, create a new pattern with a file called pagination.php.
Add this code, and save.
In the parts folder, create a new file called pagination.html.
Add this code:
Open home.html.
Add the following code inside the query loop, but outside the post template:
Go to the Site editor and open then home template. Reset customizations.
Confirm that the pagination blocks are in the template.
View the front of the site, confirm that the pagination blocks are visible and that the pagination works. The results should be correct no matter which of the 3 sets of pagination blocks that are used.