-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New Block: Add Query Total block for displaying total query results or ranges #67629
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
New Block: Add Query Total block for displaying total query results or ranges #67629
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. |
I’m relatively new to contributing, but I’ve taken a bold step with this PR. I apologize in advance if I’ve made any mistakes along the way! |
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.
Having this in core is going to be super helpful! :) Added some initial notes 👍
@fabiankaegy I’ve implemented the requested changes. Could you please help me with the failing test? I’m currently working on the |
I think all the JS ones are due to the missing fixture. The PHP ones are because the two functions you added are missing an |
It looks like there is also an experimental block Comments Count that would be very similar. I don't know why it is still experimental, but it was raised by @carolinan recently on WordPress Slack: https://wordpress.slack.com/archives/C02QB2JS7/p1733463619396909. In case we decide to add this Query related block, we should mirror the handling with the one related to Comments. |
@gziolo here, by handling do you mean the appearance?? |
Co-authored-by: Greg Ziółkowski <grzegorz@gziolo.pl>
@sarthaknagoshe2002 Actually, regarding the settings sidebar. Right now you are adding an empty panel in the sidebar. We should change that to maybe move the dropdown of options from the block toolbar into the sidebar here. |
Tricky one. In fact I think all pagination, including this smmary which is related to pagination, need a visual refresh. One instinct for making them related, is putting them in a box. For now, I drew a perhaps nicer summary icon, it's not a bad metaphor:
If there's a better metaphor, let's go for it, but perhaps for now this can allow the feature to ship. And as noted, if we like it, let's follow up with better designs for the other pagination icons. |
For this I have tried to maintain consistency with the search block.
|
The main thing here if we want to keep the control in the toolbar (which I'm fine with) is that we then should remove everything in the Inspector 🤔 Right now the inspector has some text in it but no controls |
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.
As shared earlier, I'll approve the code aspects of the new block. It's looking solid from my perspective. Excellent collaboration @sarthaknagoshe2002. That was a fast and efficient feedback loop 🙇🏻
Let's finalize the design decisions before proceeding with merging.
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 works well and the experience in the editor is as expected :)
Great job here! This is ready to go :)
@fabiankaegy @gziolo Thank you so much for your invaluable support with this PR. Honestly, this feels like a significant milestone in my journey as a contributor. I truly appreciate you guiding me and making me feel at ease as a rookie. Thanks again for carrying me through and creating such a welcoming and supportive environment! |
…s or ranges (WordPress#67629) Co-authored-by: sarthaknagoshe2002 <sarthaknagoshe2002@git.wordpress.org> Co-authored-by: fabiankaegy <fabiankaegy@git.wordpress.org> Co-authored-by: gziolo <gziolo@git.wordpress.org> Co-authored-by: jasmussen <joen@git.wordpress.org> Co-authored-by: codersantosh <codersantosh@git.wordpress.org> Co-authored-by: bhubbard <bhubbard@git.wordpress.org>
Closes: #62423
What?
This PR adds a core/query-total block to display query-related information, such as the total number of results or the range of results currently displayed.
Why?
Currently, there is no block that displays the total number of query results or the range of displayed results, limiting users' ability to convey query information effectively. This block enhances usability and customization options in the block editor.
How?
displayType
to toggle between "Total Results" and "Range Display."query context
(queryId, query).Testing Instructions
displayType
attribute to "Total Results" or "Range Display" via block controls.Screenshots or screencast
query-total.block.mov