-
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
Add order/order by support in Query block #24691
Conversation
Size Change: +143 B (0%) Total Size: 1.17 MB
ℹ️ View Unchanged
|
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.
Great work @ntsekouras ! I tested this and it works. I found it to be a bit slow to update locally, plus the transitions are a bit jarring when the query is changed. This is out of the scope of this PR, but I wanted to mention b/c I added two design labels.
I added "Needs design" because the whole query block could use more direction, but particulaly, and why I added "Needs design feedback" I wonder this:
- does the toolbar filtering provide a better experience (with a closed inspector) in the context of the site editor where any screen real estate allows content to display better (e.g. sidebars not to collapse because of the inspector)?
If this is the case perhaps we could keep the filtering in the toolbar and polish that interaction more?
Thanks for looking into this @draganescu!
This is true and at first I had put sorting in the toolbar, but since it's just the first step of I have the impression that toolbar is right for the most common/used settings and the sidebar is for a bit more Also I haven't dig into how the display options would be integrated in the Having said that, the change of this specific --cc @jasmussen @kjellr any thoughts? |
I took a quick look, and alas I've been out of the query loop (if you'll forgive the pun) — how do I best test this? (Here's my failed GIF exploration). High level I do think I agree that we need some high level design work on the query block. I wonder if it could be a good candidate for @ItsJonQ's component work? But I also wonder: shouldn't that be a separate issue to discuss on, rather than hold up this PR? |
Yes, there's a tracking issue in #24762 to organize the query block work. It'd be good to start by identifying the parameters to support from WP_Query and map it to a UI. Then we can ran that through @ItsJonQ explorations and ensure we are covering all that is needed. |
I agree that we should identify the parameters to support from WP_Query, but this is definitely going to be included (order/orderby title and date). The implemented functionality can be easily moved later with the design decisions, but I think this is a small improvement from what is shipped now, no? What do you think? @mtias @draganescu |
Yes, deifnitely! |
d0abb27
to
3fc613a
Compare
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 tested this and while it still requires some decision on where to place all the filters and other new settings it works all right and it is a step forward. Code-wise it follows the structure of the rest of the block so 🚢 it!
Description
This is a part of #24521 whose ultimate goal is to make
Latest posts
block a block variation ofQuery
block.This PR adds
order
andorderby
(date + title) support for theQuery
block. This functionality is imported fromQueryControls
which is a component tightly coupled with query filters and seems to be a good place to build upon.There will also be follow up PRs that will enhance the
Query
block andQueryControls
component so as to support more options from the API.Although the previous options for
Query
block where in the block toolbar, I placed the new sorting addition is in the block inspector controls. This seemed to be a better place for adding a lot more options ( to me :) ) as it would be really crowded to add so many things in the toolbar. Of course this could be decided and kept or changed later by just moving these components.Checklist: