-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Feature: Allow Post Template block to get deeply nested within Query Block #67657
Feature: Allow Post Template block to get deeply nested within Query Block #67657
Conversation
That makes sense to me. It feels like an oversight. Any context @ntsekouras maybe |
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 If 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. |
The It looks like @ntsekouras also created a similar PR - #48348. |
Ahh great find @Mamaduka Happy to move forward with that PR also if we want that instead 👍 @carolinan since already addressed the |
I understood about two words of the PR description, I would encourage I still think this change should happen. |
Sorry @carolinan. You are right, I should have created an issue first. I realize the way I described the use cases here was quite cumbersome. The whole Interactivity API powered enhanced pagination makes it possible to build Custom blocks which talk to the Query block and therefore now support building complex search / filtering experiences. An example of this in Core can be found in #67289 where the Search block is getting hooked up to the query. In order for these filter / search blocks to actually talk to the query block they need to be nested within the Query. Because of this need to be nested we run into many design limitations since it is impossible today to nest the Post Template block inside any other blocks such as a group or columns block. A common design pattern here is to have a sidebar that contains all the filters and then a content area next to it that contains the list of posts. Switching from |
The PHP tests keeps failing 🤷♀️ |
@fabiankaegy, I think we can merge this and address the remaining blocks in #48348. @ntsekouras, what do you think? |
Thank you! I rebased the old PR to update the |
…Block (WordPress#67657) Co-authored-by: fabiankaegy <[email protected]> Co-authored-by: carolinan <[email protected]> Co-authored-by: youknowriad <[email protected]> Co-authored-by: Mamaduka <[email protected]> Co-authored-by: ntsekouras <[email protected]>
What?
Allow the "Post Template" block to get nested deeply inside the "Query" block.
Why?
Especially now with the advent of region-based routing in the interactivity API we need to be able to place more other controls into the "Query" block so they can talk to the correct region router. This means if we built a custom filtering sidebar for example we need to place that query filter block into the query itself.
In order to actually be able to create rich layouts in these cases we also need to be able to move the actual list of posts around and nest it in a columns block for example.
Moving from
parent
toancestor
allows just that.The "Post Template" block actually is the block that renders the
ul
element containing all the posts. So, moving this into a column still has 100% valid markup.I've been running this on a few projects by manually overriding the
parent
toancestor
via theblock_type_metadata
filter.Interestingly enough the Core TwentyTwentyFive theme even ships patterns that force this deeply nested structure in patterns.
https://github.com/WordPress/wordpress-develop/blob/8eb8d634095e9b6716e977abd1085bab8d703e6f/src/wp-content/themes/twentytwentyfive/patterns/template-query-loop-photo-blog.php#L30-L32
This would not be possible in the UI today but this PR will enable it.
How?
Changing
parent
toancestor
in theblock.json
Testing Instructions