Skip to content
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 improvements v2 #41405

Open
10 of 37 tasks
priethor opened this issue May 27, 2022 · 11 comments
Open
10 of 37 tasks

Query Loop improvements v2 #41405

priethor opened this issue May 27, 2022 · 11 comments
Labels
[Block] Query Loop Affects the Query Loop Block [Type] Tracking Issue Tactical breakdown of efforts across the codebase and/or tied to Overview issues.

Comments

@priethor
Copy link
Contributor

priethor commented May 27, 2022

Supersedes #30910

Since the Query Loop block landed back in WordPress 5.8 and even before, numerous feedback and feature requests have been received.

The Query Loop block is such a powerful site-building tool that striking a balance between functionality and usability is critical. Therefore, ensuring optimal insertion flows and editing experience should be prioritized and considered when adding new features.

Also, leveraging block variations to consolidate similar blocks into the Query Loop will increase code reusability while improving those blocks.

High priority

Consolidating block variations

Insertion workflows

Editing experience

Bugs

Normal priority

Layouts

Design & Styling

WP_Query parity, functionality enhancements and other settings

Performance

@priethor priethor added [Type] Tracking Issue Tactical breakdown of efforts across the codebase and/or tied to Overview issues. [Block] Query Loop Affects the Query Loop Block labels May 27, 2022
@annezazu
Copy link
Contributor

Is there any chance the following can be added under editing experience #25198 Based on FSE Outreach program feedback over the last few years, it's clear that more needs to be done to reimagine the various division of settings and the language used #31158. This feels similar to the work done recently to improve the layout controls #41893 For example, it's long been confusing for folks that to control the number of posts that show, you have to change a setting in the block toolbar rather than the sidebar where you pick which posts to display.

@padams
Copy link

padams commented Jul 28, 2022

It would be wonderful if we could add the attachment post type as an option (or really any custom post type or taxonomy for that matter).

@ntsekouras
Copy link
Contributor

It would be wonderful if we could add the attachment post type as an option (or really any custom post type or taxonomy for that matter).

👋 @padams - Query Loop supports custom post types and taxonomies for filtering for a while now. Were you referring to something different than filtering?

Regarding the attachment option, it is explicitly removed from the available options right now as it's a probably rare use case and would add more cognitive load to most users. Is this something you find useful and missing?

@padams
Copy link

padams commented Aug 8, 2022

👋 @padams - Query Loop supports custom post types and taxonomies for filtering for a while now. Were you referring to something different than filtering?

Right. Just not image taxonomies...

Regarding the attachment option, it is explicitly removed from the available options right now as it's a probably rare use case and would add more cognitive load to most users. Is this something you find useful and missing?

Yes. My primary use case for WordPress is a searchable image archive. Being able to do a simple loop of the "latest images" or a loop that pulls the images for a specific custom taxonomy term would eliminate the need for a lot of plugins and custom php templates.

The killer combo IMHO would be for the gallery block to use the query block as a sort of inner block. That would give unprecedented control over galleries and keep the attachment stuff in its lane.

Right now plug-in developers have essentially recreate the gallery block just to change the query it uses.

@NicoHood

This comment was marked as off-topic.

@bph

This comment was marked as off-topic.

@NicoHood

This comment was marked as off-topic.

@t0mtaylor
Copy link

Not sure if this can be looked at also?

change the url of the Pagination block from /?query-8-page=2/ to /page/2/

https://wordpress.org/support/topic/how-to-change-the-url-of-the-pagination-block-from-query-8-page2-to-page-2/

@ntsekouras
Copy link
Contributor

change the url of the Pagination block from /?query-8-page=2/ to /page/2/

This is because we support multiple Query Loop blocks in the same page. So the ones that inherit the query from template do use the above format. But with multiple blocks we can have urls like this: /page/2/?query-10-page=2, as we preserve pagination for all the blocks.

@t0mtaylor
Copy link

t0mtaylor commented Jun 15, 2023

change the url of the Pagination block from /?query-8-page=2/ to /page/2/

This is because we support multiple Query Loop blocks in the same page. So the ones that inherit the query from template do use the above format. But with multiple blocks we can have urls like this: /page/2/?query-10-page=2, as we preserve pagination for all the blocks.

Ah I see! Thanks @ntsekouras

What about if there is only one query loop block on the page? could we enforce an option so it is percieved as a friendly rewrite url? /page/2/

Does the latest version already support /page/2/?query-10-page=2 the friendly url stem even though it has the additional query string (as mentioned about multiple query loops per page)? If so what are the settings or functions.php snippet to do this?

You can add the rewrite url into the functions.php file, but how do you they update the url behaviour of the pagination links, next and previous, of the query loop block?

add_action( 'init', function() { add_rewrite_rule( '^read-pg/([0-9]+)[/]?$', 'index.php?query-8-page=$matches[1]', 'top' ); } );

@ntsekouras
Copy link
Contributor

What about if there is only one query loop block on the page? could we enforce an option so it is percieved as a friendly rewrite url? /page/2/

I'm not really sure if we could, as the WP core handling for paging could mess with the actual query and the pagination. I don't have much experience with the url rewriting..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Query Loop Affects the Query Loop Block [Type] Tracking Issue Tactical breakdown of efforts across the codebase and/or tied to Overview issues.
Projects
None yet
Development

No branches or pull requests

7 participants