Skip to content
This repository has been archived by the owner on Oct 28, 2022. It is now read-only.

Add additional post/page templates #136

Merged
merged 14 commits into from
Sep 2, 2022
Merged

Conversation

mikachan
Copy link
Member

@mikachan mikachan commented Aug 30, 2022

This PR adds additional templates to offer the following options for single posts and pages:

  • No featured image or cover block (by default)
  • With a featured image
  • With a cover block (that automatically uses the featured image)

It also attempts to make the markup more consistent across the different templates:

  • Moves the post meta markup into a template part, to make it easy to reuse across multiple templates
  • Updates a couple of layout settings to reduce potential merge conflicts with WIP: Update templates to use the new layout setting #121
  • Moves the common spacing used around comments to the comments template part (spacing-40)

Addresses #101 & part of #133.

Screenshots

No featured image:
image

With a featured image:
image

With a cover block:
image

With a cover block and featured image:
image

<div class="wp-block-column">
<!-- wp:group {"style":{"spacing":{"blockGap":"1ch"}},"layout":{"type":"flex"}} -->
<div class="wp-block-group">
<!-- wp:paragraph --><p>Posted</p><!-- /wp:paragraph --><!-- wp:post-date {"format":"F j, Y"} /-->
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(If we are going to make it translation ready, it needs to be in a pattern)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! I've made it a pattern now.

@carolinan
Copy link
Collaborator

I am not 100% convinced that the cover block in the single template has a purpose unless the post title is the inner content?
(but then it doesn't match what is seen in the post editor)

@mikachan
Copy link
Member Author

I am not 100% convinced that the cover block in the single template has a purpose unless the post title is the inner content?

Yeah, I think this is a really good point, and I like that this would make it even more different from the default template. I've made this change so we can test it out.

I think it's OK that this doesn't match the layout in the post editor, for now.

@critterverse
Copy link
Collaborator

Good call on moving the title into the Cover block — that works well and I don't think it's an issue with the Cover block not being visible in the post editor.

One question about the overlay on the Cover block: am I correct in understanding that the overlay color can be set in theme.json but not the opacity? I'm wondering if we should bump the base opacity to at least 50 so that any cool gradient effects could be slightly more visible by default.

@richtabor
Copy link
Member

One question about the overlay on the Cover block: am I correct in understanding that the overlay color can be set in theme.json but not the opacity?

Correct. The opacity can be set in the template though. I think 50 would probably work.

@mikachan
Copy link
Member Author

Thanks both! I've set the opacity to 50.

/**
* Title: Post Meta
* Slug: twentytwentythree/post-meta
* Categories: post meta
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This block pattern category does not exist. It could be registered, or another category can be picked and this can be used as keywords instead.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yeah, thanks. I meant to come back to this! I've changed the category to 'query', as this would always be used alongside a post query. If this doesn't work, maybe 'text' would work? And I've added 'post meta' as keywords 👍

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think query is OK.. it is not a query loop but it can be placed in one to create new blog layouts.

<div class="wp-block-column">
<!-- wp:group {"style":{"spacing":{"blockGap":"1ch"}},"layout":{"type":"flex"}} -->
<div class="wp-block-group">
<!-- wp:paragraph --><p><?php echo esc_html_x( 'Posted', 'Verb to explain the publication status of a post', 'twentytwentythree' ); ?></p><!-- /wp:paragraph --><!-- wp:post-date {"format":"F j, Y"} /-->
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the block break if the date format is made translatable? (untested)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it seems to be fine! I've just pushed a commit that allows this to be translatable, and I can see the format still working correctly both in the editor and on the front end. I'm also still able to change it from the site editor.

@mikachan mikachan merged commit ce90ef2 into trunk Sep 2, 2022
@mikachan mikachan deleted the add/additional-single-templates branch September 2, 2022 08:14
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
[Type] Enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider removing featured image from single post template
4 participants