Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #58154


Ignore:
Timestamp:
04/18/2023 06:53:56 PM (8 months ago)
Author:
flixos90
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #58154 – Description

    initial v1  
    44* TT3 is not using the `core/query` and `core/post-template` blocks in its `page.html` and `single.html` template. While that may intuitively seem like the right thing to do since these templates only display a single post, it is not: It has always been a best practice to always go through the query loop (i.e. `while( have_posts() ) { the_post(); ... }`), classic themes have always been doing that - check e.g. TT1's `page.php` and `single.php` for reference.
    55* Not going through the query loop leads to several problems as the loop is never started, which apparently were so far were partially addressed by workarounds in Gutenberg, e.g. automatically starting the loop when in the `core/post-content` block, or similarly later in the `core/post-featured-image` block. These are workarounds though that lead to other bugs like #58027.
    6 * Additionally, wherever TT3 uses the `core/query` block, it includes parameters that customize the query, which should not happen as those templates should simply use the global main query, similar to how the equivalent classic themes would do it. In other words, all usages of the `core/query` block should solely set `{"query":{"inherit": true}}` and no other "query"-specific parameters (layout parameters are okay of course).
     6* Additionally, wherever TT3 uses the `core/query` block, it includes parameters that customize the query, which should not happen as those templates should use the global main query, similar to how the equivalent classic themes would do it. In other words, preferably all usages of the `core/query` block should solely set `{"query":{"inherit": true}}` and no other "query"-specific parameters (layout parameters are okay of course).
     7* However, it appears that the Site Editor itself has no awareness of the global query, so omitting the additional parameters leads to problems there. As long as that is the case, it makes sense to keep the additional parameters, but at a minimum it has to be ensured that every `core/query` usage includes `query.inherit=true`, so that the global query is relied on in the frontend.
    78
    89There are a few other related aspects that need to be fixed in core & Gutenberg directly, but as a starting point we need to use the `core/query` block correctly in TT3.