[wp-trac] [WordPress Trac] #59759: Twenty Twenty-Four blog template ignores main query and breaks navigation
WordPress Trac
noreply at wordpress.org
Fri Oct 27 17:14:35 UTC 2023
#59759: Twenty Twenty-Four blog template ignores main query and breaks navigation
---------------------------+-------------------------------------
Reporter: flixos90 | Owner: (none)
Type: defect (bug) | Status: new
Priority: high | Milestone: 6.4
Component: Bundled Theme | Version: trunk
Severity: normal | Keywords: needs-patch 2nd-opinion
Focuses: template |
---------------------------+-------------------------------------
While recently testing the new TT4 default theme, I ran into a problem
(reported in
[https://github.com/WordPress/twentytwentyfour/issues/404#issuecomment-1781623974
this GitHub comment]) from which I then noticed a more severe bug (also
see
[https://github.com/WordPress/twentytwentyfour/issues/404#issuecomment-1783156487
another GitHub comment specific to this ticket]): The TT4 blog template is
broken in an essential way that prevents using the blog as expected.
* It always displays the 3 latest posts. This ignores the "Blog pages show
at most" setting under Settings > Reading.
* It ''always'' displays the 3 latest posts. In other words, if your site
has more posts than configured to show per blog page and you navigate to
e.g. /page/2/, you will still see the 3 latest posts, instead of the next
page of posts.
**Reason for the bug:**
Both of these problems are happening because TT4 uses `inherit: false` in
its `core/query` block used in the `home.html` template (via the included
`posts-grid-2-col.php` pattern), which means the main query is ignored.
While custom `core/query` blocks are of course fine to use, there should
be at least one `core/query` block in every template that displays the
expected content based on the URL (e.g. the specific page or post or list
of posts). While there can be exceptions to that rule (e.g. a page with
very custom layout), the main query should be respected especially for an
essential WordPress feature like the blog.
**Proposed solution:**
It appears the custom query approach was taken to nicely split the 3 posts
displayed into two columns. While that is a creative design decision,
unfortunately the way it's implemented doesn't work per the above, and
most likely we won't be able to accomplish the same layout while using the
current capabilities of the `core/query` block. However, given the
breakage, I think we'll have to find another solution.
I think we should reuse the same `core/query` and layout approach that is
being applied in the TT4 `index.html` template (more specifically the
`posts-3-col.php` pattern), since that template correctly relies on the
main query to display posts in multiple columns. We may need to make a few
adjustments while integrating that layout into the relevant section within
the `home.html` template (potentially requires a slightly modified version
of the existing pattern), but trying to use the existing `posts-3-col.php`
pattern instead of the `posts-grid-2-col.php` pattern would be a good
start.
Alternatively, we could try to update `posts-grid-2-col.php` to make that
layout work while relying on the main query, but we may get stuck in that
effort by the current `core/query` block not supporting that, so it would
be more risky especially given we are this late in the 6.4 release cycle.
**A note on severity:**
If we ship TT4 in this state, we will effectively ship a default theme
which in its default configuration comes with a broken blog - and next to
pages, posts are still the essence of WordPress content. So I think this
needs to be prioritized for 6.4.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/59759>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list