Automattic / themes

Free WordPress themes made by Automattic for WordPress.org and WordPress.com.
https://themeshaper.com
GNU General Public License v2.0
888 stars 355 forks source link

Tenaz: Use one query block per section in front page template #7831

Closed creativecoder closed 1 month ago

creativecoder commented 4 months ago

Changes proposed in this Pull Request:

Before After
image image
github-actions[bot] commented 4 months ago

Preview changes

I've detected changes to the following themes in this PR: Tenaz.

You can preview these changes by following the links below:

I will update this comment with the latest preview links as you push more changes to this PR. ⚠️ Note: The preview sites are created using WordPress Playground. You can add content, edit settings, and test the themes as you would on a real site, but please note that changes are not saved between sessions.

⚠️ Note: Child themes are dependent on their parent themes. You will have to install the parent theme as well for the preview to work correctly.

iamtakashi commented 4 months ago

Interesting! I don't know how I feel about the necessity of using CSS to control the font size and hide the excerpt, though. Having a single query loop block allows pagination to work, but I'm not sure if we want to pay that price to have a pagination in this specific theme.

Also, on the front of the site, I can see one extra post appears. It seems like the number of sticky post is added to the number of posts specified in the query loop block. This isn't caused by this PR, but it surfaced the issue.

CleanShot 2024-05-28 at 18 44 48@2x

creativecoder commented 4 months ago

Thanks for taking a look @iamtakashi !

This is definitely an experiment, and I'm also unsure it's worth the tradeoff of simplifying the block layout for the template. As you point out, hiding the excerpt feels particularly hacky.

Another idea that occurred to me is to enhance the Query Loop block so that it can support multiple Post Template child blocks. This way you could apply different layouts to different posts in a single loop (the Post Template block would need some way to target a subset of the posts query, maybe something like the CSS nth-child syntax). But that would add a lot of complexity, so again I'm not sure it's a worthy tradeoff.

I'll open an issue or discussion in Gutenberg and see if there are other ideas for how the Query Loop could better handle multiple layouts for a single query.

With a quick search, I did find another idea: Query Loop Block: Adding Multiple Query Loop Blocks with the option to not repeat posts already shown by previous Query Loop on same page #40903

creativecoder commented 4 months ago

I converted this to a draft to indicate it's still experimental.

creativecoder commented 1 month ago

Closing this until there's a better solution on the editor side.