-
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
Context detection for Query block #30369
Comments
What would be the immediate advantage of this effort? |
@richtabor When you use a query block e.g. in a page, with In other words: While having Potentially we could even go further and not even offer the |
Thanks for giving all this context, @felixarntz 🙏 The Query Loop block has had some updates recently, with the last major one in #65820. The block will now:
With all these recent changes, perhaps we could close this issue? |
Okay, let's close this one. Thank you! |
Is it possible to override this, with a filter or something? I have an existing site that used inherit=true on a page, and that page's content got output on archives like tags and categories (allowing me add blocks above and below the core/query that appear on all blog, tag, and category pages) It was working great, inheriting the template's query appropriately. I understand FSE would be the way to go in the future, but it'd be a huge lift to convert this site over to FSE. I tried the following, but inherit is always equal to false on the front end for me now:
EDIT: I also tried the following as it matches $block's structure, but this also doesn't work.
|
We need to find a way to detect the context a
Query
block 'lives' and handle any settings needed appropriately. Bycontext
I mean FSE context (site-editor) or a page/post (post-editor). Moreover is valuable to even know the kind of template we are on FSE context (related: #29438).Noting that we'll also have to take into account what happens when we are in
post-editor
and weedit the template
from there.There is an
inherit
property inQuery
which defaults totrue
and with that set, the Query'squery
for fetching results is inherited from the global query. In a single page there is no much use in having an inherit Query (doesn't fetch anything), but instead a custom one. On the other hand in anarchive
orindex
template proper results are shown without taking into account any other previously explicitly set options (like the number of posts).Some prior art is here: #27972, where
templateSlug
is passed as context and is used for now inQueryLoop
to set the properpostType
if we are in an archive template.The text was updated successfully, but these errors were encountered: