Add a home page template using the latest posts block to 2019 - #20
Conversation
| <!-- wp:group {"align":"full","className":"site-content"} --> | ||
| <div class="wp-block-group alignfull site-content"><div class="wp-block-group__inner-container"><!-- wp:post-title /--><!-- wp:post-content /--></div></div> | ||
| <div class="wp-block-group alignfull site-content"><div class="wp-block-group__inner-container"> | ||
| <!-- wp:latest-posts {"postsToShow":100,"displayPostContent":true,"displayPostDate":true} /--> |
There was a problem hiding this comment.
I'm showing 100 posts now because pagination is not supported yet.
There was a problem hiding this comment.
I'm also showing the excerpt, post date and title. Ideally, this would use a "Query" block where you could decide to show post comment count... (but the query block is not implemented yet).
There was a problem hiding this comment.
Definitely should be a Query since we need to read from the query context. It's also why I don't think adding pagination support to latest posts is a great idea: WordPress/gutenberg#19969 (comment)
| } | ||
|
|
||
| /* Latest posts block */ | ||
| .wp-block-latest-posts li > a { |
There was a problem hiding this comment.
One potential answer for this would be this proposal WordPress/gutenberg#20290
kjellr
left a comment
There was a problem hiding this comment.
This looks good! Fully agree that this should be done with the Query block when it's ready... the latest posts block actually has some very different built-in styles:
(Honestly, those original styles look like a bug, so I'll look into that later 😅)
Luckily for the moment, those styles aren't being inherited here. 😄 This PR pointed out that the default block styles like those are only being used if the block lives directly inside of an "approved" container such as .entry-content, .site-header, or .site-footer. This is fine for now, but the original Twenty Nineteen style.css file could probably use a refactor in another PR so that those styles are less specific.
In any case, I added some minor fixes, and I think this is good to go as a proof of concept. We can revisit when the query block is live.

This PR tries to add a home page showing the list of posts to the 2019 theme using the recent posts block.