-
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
Query Loop Block: add variations for each post type #63380
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 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. |
Size Change: +319 B (+0.02%) Total Size: 1.76 MB
ℹ️ View Unchanged
|
), | ||
attributes: { | ||
query: { | ||
postType: postType.slug, |
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.
I think this PR is going to create more issues that it solves, mainly because if you select a post type, you can't set the query to "inherit" true.
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.
There are more nuances than inherit
. An example is the isActive
, existing Posts List variation, Pages List block etc.. Also I'm pretty confident that we used to need the other query
attributed due to the way we handle object
attributes in general..
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.
Ok, then maybe we need to change the name depending on the main query that the current template is on.
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.
Also, there's already a "Posts List" variation, we should probably remove that then
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.
Removed it here: #63404
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.
If we'd remove the Posts List variation, it should be done here and definitely not in it's own PR without having the alternative landed..
Please see the issue I linked above for some more nuances.
Additionally as @Mamaduka also mentions, this should be done server side and avoid all this complexity in the client and the subscription.
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.
Also see #63353 description where I share some thoughts on this.
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.
I was going to close this PR because of the issues? Not sure if it makes sense to add the variations at all, if it has to inherit the query, we should probably dynamically name it based on what the main query is.
We can use server-side variation registration here. All post-type data is already available on the server. See the Post Terms block example:
|
There is an old issue for this: #40941. There were some nuances discussed there.. |
What?
Adds a query loop block variation for each post type so it shows up in the inserter when searching for "posts", "pages", "portfolio" (custom post types), etc.
Also adds the "blog" keyword for the post variation.
Why?
It doesn't show up if you search for it with these words.
How?
Testing Instructions
Search the inserter.
Testing Instructions for Keyboard
Screenshots or screencast
Another nice thing is that you get a preview for that particular post type. For example I had no posts a this site, but I did have pages.