-
Notifications
You must be signed in to change notification settings - Fork 182
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
Add a home page template using the latest posts block to 2019 #20
Conversation
@@ -3,7 +3,9 @@ | |||
<!-- /wp:group --> | |||
|
|||
<!-- 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm showing 100 posts now because pagination is not supported yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)
@@ -112,6 +120,27 @@ Tags: one-column, flexible-header, accessibility-ready, custom-colors, custom-me | |||
} | |||
} | |||
|
|||
/* Latest posts block */ | |||
.wp-block-latest-posts li > a { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One potential answer for this would be this proposal WordPress/gutenberg#20290
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.