-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Site Editor: Add more template types #39353
Conversation
Size Change: +2.02 kB (0%) Total Size: 1.16 MB
ℹ️ View Unchanged
|
Nice, looks like a good first step. I'd still try to adjust the order so that we emphasize most common ones more (attachment, taxonomy, 404 towards the end). |
I updated the order to this:
|
I added a commit to split the templates into static and dynamic. |
I don't think that split makes a ton of sense. 404 would be dynamic to the user from the perspective it can be shown for different permalinks. The only split I'd make is for "custom" templates (page templates or post type templates) that you can apply to existing posts or pages. |
7225052
to
349e890
Compare
OK I removed the divide for now, we can iterate that on another PR. I also updated the 404 icon... |
Nice. I wonder if the "Block Meta" icon might work better for the taxonomy template? I noticed you renamed 'Attachment' to 'Media'. I think it's probably a good change, but might it trip up theme authors who are used to attachment.php? The Tag template description is missing a word. Not something to address here, but as we provide users with the ability to create more templates, the resulting blank canvas becomes a bigger issue. I don't know that this should be blocked by #37258, but it would be nice to get that in as well. |
This is the name that is already being used in Gutenberg - I just referenced that |
Looks good, do you have the SVG? |
I added some core tickets for the copy changes: |
Thank you for working on this Ben! It is much appreciated! Testing the PR using a local dev site running 5.9.2. The template list can gradually become fairly long. Should there be a way to sort (sorting icon in the top right corner on the line with Add New template) or default the list by alphabetical order? I like the overview of icons and the text. As it gives a visual hint as well as text that explains what each is. Author template in place. Should templates have default content added? Helping the process of adding content. |
How do you create a working attachment template that shows the attachment (The media)? |
Agreed, we should exclude Media / Attachment for now. |
Done in 9ec45b6 |
page, | ||
archive, | ||
search, | ||
fourZeroFour, |
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.
Maybe notFound
is better :D
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.
Looks good to start, it unlocks a lot of useful possibilities.
@scruffian sorry I thought it'd already been added to the library. Here's the svg:
|
I added the block meta icon... |
046b859
to
fe5c793
Compare
@@ -154,7 +154,7 @@ function get_default_block_template_types() { | |||
), | |||
'tag' => array( | |||
'title' => _x( 'Tag', 'Template name', 'gutenberg' ), | |||
'description' => __( 'Displays latest posts with single post tag.', 'gutenberg' ), | |||
'description' => __( 'Displays latest posts with a single post tag.', 'gutenberg' ), |
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.
@Mamaduka, it's a simple change that we could backport as a bug fix for WordPress 5.9.x since it was introduced in WP 5.9. Otherwise, we might miss it for WP 6.0 because it's in the compat folder for 5.9.
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 did also submit this as a core patch so maybe that's not necessary?
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 see https://core.trac.wordpress.org/ticket/55374 has landed but it won't be released until WP 6.0. Thank you!
What?
This adds more template types to the Site Editor template creation flow, specifically:
Why?
So that users can create a broader selection of templates. Addresses, in part, #37407.
How?
Adding more template types is trivial - we just add them to the array. This PR also adds icons to the menu for each of these to make it easier to scan as per #37407. There are more changes suggested in #37407, including altering the order of these items and dividing them into logical groups. This PR is the first step towards that goal.
I'm not 100% sure about all of these icons - I couldn't find a paperclip icon...
Testing Instructions
Screenshots or screencast