-
Notifications
You must be signed in to change notification settings - Fork 1
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
wp:query-loop doesn't dynamically use the chosen category #11
Comments
Testing
|
My new version of
|
Gutenberg's Query loop logic now uses I'm now of the opinion that my override logic still works when the Note: Instead of using I need to test and/or change:
|
I've changed |
It appears that the commit in 0c3f331 didn't have |
I've implemented the
category.html
template as far as possible, with the current Gutenberg FSE functionality.There are a number of problems:
Requirement
The Gutenberg blocks
wp:query
,wp:query-loop
andwp:query
can be used in templates and template parts to create user defined queries and pagination.Currently ( Gutenberg 9.2.2 ) they don't support the main query that WordPress has already parsed.
This makes it extremely difficult to create archive pages that support the selected taxonomy term ( category, tags or custom taxonomy ).
I need a simple solution that allows me to process the posts in the main query.
Proposed solution
In the current implementation the
wp:query-loop
block is nested in thewp:query
block.The
wp:post-*
blocks are nested within thewp:query-loop
.eg
The
query-loop
block uses the$block->context
passed to it from thequery
block to construct the query.When we want to process the main loop we need to execute the query already defined in global
$wp_query
.This can be achieved using the following code:
If we remove the outer
wp:query
block then the$block->context
will not be set.This will prompt us to run the main query.
eg
Steps:
For query-loop:
gutenberg_render_block_core_query_loop()
inquery-loop.php
.For query-pagination:
The text was updated successfully, but these errors were encountered: