You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Expand the types of templates that can be added in the Site Editor #37407
Reacted by Carolina Nymark, George Mamadashvili, annezazu, chthonic-ds, Tammie Lister, Will Skora, Steve Graboski, Sagar Nasit, Paal Joachim Romdahl, Nik Tsekouras and 3 more
This would seem to be a necessary item for a viable release.
The very first thing I attempted to do when switching to the new theme and editor was to try to find how to create a Category Archive template. Couldn't find it.
Eventually I worked out that copying archive.html to category.html in twentytwentytwo did the trick, but that is very unintuitive.
Seems like the existing Template Hierarchy should be used for defaults like this, and then expose all/most templates in that hierarchy as selections to be made. If I select "Category" for the template, but there's no category.html, it falls back to archive.html in the hierarchy, and that is my starting point for customization. But the customized template I then create is still the Category template, not the Archive template.
I really like the idea of expanding, but I wonder if that then needs easier ordering or something that doesn't surface everything at the same level? I worry a little about too long a list for example and problems even finding things. Something to explore!
I'm also wondering if we'll see some overlap with #36667. If / when it is possible to work on a specific post category in the site editor, it seems plausible that we'd offer a way to spawn a new template for that category as a part of the overall flow.
The very first thing I attempted to do when switching to the new theme and editor was to try to find how to create a Category Archive template.
Adding the secondary category template as an option for folks to create would obviously be a simple change we could make any time.
Seems like the existing Template Hierarchy should be used for defaults like this, and then expose all/most templates in that hierarchy as selections to be made. If I select "Category" for the template, but there's no category.html, it falls back to archive.html in the hierarchy, and that is my starting point for customization.
I think what you're describing is being worked on here.
Saw that this issue mentioned the possibility of creating custom post type templates in the Site Editor. Like several other web developers, I help manage a WP Multisite implementation. If the Site Editor allowed devs like us to make CPT templates, it would make for a profound improvement to our experience with WordPress.
For starters, we could remove several child themes that exist only to provide our departments with CPT layouts, archives, and search pages. The only files we would need are the plugins that define the CPTs. Who wouldn't love a less complicated repo?
The advantages stretch past the dev team. In theory, we could offer our editors the ability to edit these CPT templates, no coding required. This would enable our non-programming co-workers to change template layouts without relying on our assistance. The editors get more power over their sites, and the developers gain more hours of productivity.
tl;dr, custom post type template creation through FSE would lend editors more freedom to change the site, while reducing the number of theme files developers would need to maintain.
Custom Post Type templates are an interesting one, because it brings in to question the creation of the CPTs themselves.
Creating templates for existing CPTs feels like table stakes, but also a fairly developer oriented solution because it requires the CPT to be registered in the first place.
Thinking further along the road... I wonder if there's a world where the Site Editor could enable users to add modules like "Portfolio" or "Testimonials". These modules could register the CPT and create all the necessary templates in a single flow. This would eliminate both the child theme and the plugin dependency from your example. With block patterns and other tools available to us we could potentially make this quite a compelling experience.
Reacted by xdevelx
Reacted by Carolina Nymark, Paal Joachim Romdahl and H. Adam Lenz
@jameskoster I enjoy the idea that core might provide a UI for CPT creation, sometimes I want a CPT, but don't want to have to pull out the code editor to do it, especially if it's going to have pretty much the same capabilities as a post.
I'd also like to mention that as the ability to make more templates (and variations) comes into play, the ability to duplicate a customized template (and in the flow of doing so, assign the customizations to a different template) will be very very useful – I made an issue for that recently, #38192 (edit: I've closed the issue and added my comments to another existing issue #36665).
I spent some time exploring how we might expand the existing UI to accomodate other template types. There are a few different ways to organise things here, particularly around how we present singular / archive templates, and dynamic / static templates as well.
What I felt worked well was separating templates by their specificity. That is to say: templates that serve a static purpose (404, front-page, *-$slug etc) are grouped together, and templates with a dynamic purpose appear beneath:
It is important to note that while the list looks quite daunting, it is unlikely an end user would ever see it in its entirety like this because any template supplied by the theme would be omitted.
This arrangement elevates the prominence of creating templates for a specific context – which I think is likely to be quite a popular flow – while still making it very simple to add common templates like page. Here's a video demonstrating how the "Specific template" menu item drills into a search form where I can find entity capable of entertaining its own template:
template1.mp4
Note that those blue boxes that appear on hover are template previews. Once #37258 lands I hope it will be possible to display a reasonable preview.
The "Advanced" section at the bottom of the menu would contain templates that the average user is unlikely to use all that often, e.g. taxonomy. It may be prudent to put other less commonly used templates (like date) in here as well, and consider a different name for the section.
Another thing I considered was splitting the dynamic section by singular / archive like so:
But in the end it felt unnecessary.
Reacted by Ugyen Dorji
Reacted by annezazu, Anelia, Timothy Jacobs and Joen A.
What I don't quite understand is the need to perform a SEARCH once you want to go to a specific template. A search always implies that you know the name or that you know what you are looking for.
I would show a list of probably the most used or last created templates with possibly a filter if users have too many.
Other than that I find it a great idea to sort the templates that way.
I find it helpful to separate templates into static and dynamic as in your suggestion.
Clicking for instance "Specific template" and getting a search form. I would become lost not knowing what to search for. As I do not get a hint of options to choose from. Here I would need some additional guidance on how to proceed after selecting "Specific template".
Having static and likely "most used" dynamic templates available is helpful. A see additional template choices - see additional templates > link to open another list can also be helpful.
Merchants would need to completely rebuild the taxonomy template from scratch every time they wanted to create a variation for each product category.
This is currently quite a jarring experience when you create a Category template. When we have the category-$slug.html functionality in the UI it would be ideal if the created template automatically used the block's from it's parent in the template hierarchy.
Here's a couple of design options focussed on the process of creating templates that can be generic or specific. In this case creating category or category-recipes.
Option A
This one builds off the last concept but simplifies the UI down to just a radio list.
category-a.mp4
Option B
This one uses a two step process with more verbose descriptions.
Option B looks like a good path to explore. I miss the extra helpful text we had here:
I'll start exploring this, but with post types for start. We can always iterate on the POC I'll have soon and I guess the approach taken will be similar for taxonomies, etc..
@mtias you screenshot is a bit different from @jameskoster 's one. Is it more about the missing description?
My first thoughts for postType would be a new menu item (if eligible) that would say Post Type and have two options:
The generic one that is single template
Select a custom one (that would show the available post types like single-post, single-project, etc...)
My first thoughts for postType would be a new menu item (if eligible) that would say Post Type and have two options:
The generic one that is single template
Select a custom one (that would show the available post types like single-post, single-project, etc...)
To implement the design above consistently we'd have separate items per post type, and per taxonomy. As an example, if you had 'Products' as a CPT and 'Product categories' as a custom taxonomy then the add template menu would include:
Single product
Product archive
Product category
Clicking "Single product" would ask if you want to add single-product or single-product-$slug using the "Option B" flow. Clicking "Product archive" would create archive-product. Clicking "Product category" would ask if you want to add taxonomy-product_cat or taxonomy-product_cat-$slug, again using the flow in Option B.
Activity
Otto42 commentedon Dec 15, 2021
This would seem to be a necessary item for a viable release.
The very first thing I attempted to do when switching to the new theme and editor was to try to find how to create a Category Archive template. Couldn't find it.
Eventually I worked out that copying archive.html to category.html in twentytwentytwo did the trick, but that is very unintuitive.
Seems like the existing Template Hierarchy should be used for defaults like this, and then expose all/most templates in that hierarchy as selections to be made. If I select "Category" for the template, but there's no category.html, it falls back to archive.html in the hierarchy, and that is my starting point for customization. But the customized template I then create is still the Category template, not the Archive template.
karmatosed commentedon Dec 17, 2021
I really like the idea of expanding, but I wonder if that then needs easier ordering or something that doesn't surface everything at the same level? I worry a little about too long a list for example and problems even finding things. Something to explore!
jameskoster commentedon Dec 17, 2021
For sure, this is not a trivial project!
I'm also wondering if we'll see some overlap with #36667. If / when it is possible to work on a specific post category in the site editor, it seems plausible that we'd offer a way to spawn a new template for that category as a part of the overall flow.
jameskoster commentedon Dec 17, 2021
Adding the secondary
categorytemplate as an option for folks to create would obviously be a simple change we could make any time.I think what you're describing is being worked on here.
SJGraboski commentedon Jan 4, 2022
Saw that this issue mentioned the possibility of creating custom post type templates in the Site Editor. Like several other web developers, I help manage a WP Multisite implementation. If the Site Editor allowed devs like us to make CPT templates, it would make for a profound improvement to our experience with WordPress.
For starters, we could remove several child themes that exist only to provide our departments with CPT layouts, archives, and search pages. The only files we would need are the plugins that define the CPTs. Who wouldn't love a less complicated repo?
The advantages stretch past the dev team. In theory, we could offer our editors the ability to edit these CPT templates, no coding required. This would enable our non-programming co-workers to change template layouts without relying on our assistance. The editors get more power over their sites, and the developers gain more hours of productivity.
tl;dr, custom post type template creation through FSE would lend editors more freedom to change the site, while reducing the number of theme files developers would need to maintain.
jameskoster commentedon Jan 5, 2022
Custom Post Type templates are an interesting one, because it brings in to question the creation of the CPTs themselves.
Creating templates for existing CPTs feels like table stakes, but also a fairly developer oriented solution because it requires the CPT to be registered in the first place.
Thinking further along the road... I wonder if there's a world where the Site Editor could enable users to add modules like "Portfolio" or "Testimonials". These modules could register the CPT and create all the necessary templates in a single flow. This would eliminate both the child theme and the plugin dependency from your example. With block patterns and other tools available to us we could potentially make this quite a compelling experience.
aurooba commentedon Jan 26, 2022
@jameskoster I enjoy the idea that core might provide a UI for CPT creation, sometimes I want a CPT, but don't want to have to pull out the code editor to do it, especially if it's going to have pretty much the same capabilities as a post.
I'd also like to mention that as the ability to make more templates (and variations) comes into play, the ability to duplicate a customized template (and in the flow of doing so, assign the customizations to a different template) will be very very useful – I made an issue for that recently, #38192 (edit: I've closed the issue and added my comments to another existing issue #36665).
jameskoster commentedon Feb 8, 2022
I spent some time exploring how we might expand the existing UI to accomodate other template types. There are a few different ways to organise things here, particularly around how we present singular / archive templates, and dynamic / static templates as well.
What I felt worked well was separating templates by their specificity. That is to say: templates that serve a static purpose (
404,front-page,*-$slugetc) are grouped together, and templates with a dynamic purpose appear beneath:It is important to note that while the list looks quite daunting, it is unlikely an end user would ever see it in its entirety like this because any template supplied by the theme would be omitted.
This arrangement elevates the prominence of creating templates for a specific context – which I think is likely to be quite a popular flow – while still making it very simple to add common templates like
page. Here's a video demonstrating how the "Specific template" menu item drills into a search form where I can find entity capable of entertaining its own template:template1.mp4
Note that those blue boxes that appear on hover are template previews. Once #37258 lands I hope it will be possible to display a reasonable preview.
The "Advanced" section at the bottom of the menu would contain templates that the average user is unlikely to use all that often, e.g.
taxonomy. It may be prudent to put other less commonly used templates (likedate) in here as well, and consider a different name for the section.Another thing I considered was splitting the dynamic section by singular / archive like so:
But in the end it felt unnecessary.
anelllya commentedon Feb 10, 2022
What I don't quite understand is the need to perform a SEARCH once you want to go to a specific template. A search always implies that you know the name or that you know what you are looking for.
I would show a list of probably the most used or last created templates with possibly a filter if users have too many.
Other than that I find it a great idea to sort the templates that way.
paaljoachim commentedon Feb 10, 2022
Hey James! This is a very nice exploration!
I find it helpful to separate templates into static and dynamic as in your suggestion.
Clicking for instance "Specific template" and getting a search form. I would become lost not knowing what to search for. As I do not get a hint of options to choose from. Here I would need some additional guidance on how to proceed after selecting "Specific template".
Having static and likely "most used" dynamic templates available is helpful. A see additional template choices - see additional templates > link to open another list can also be helpful.
Kinda like this:
Static template 1
Static template 2
Static template 3
-- separater --
Dynamic template 1
Dynamic template 2
Dynamic template 3
Dynamic template 4
Dynamic template 5
Dynamic template 6
-- separater
See additional templates > (opens the Additional templates list)
Btw previewing various templates would be nice.
20 remaining items
getdave commentedon May 5, 2022
This is currently quite a jarring experience when you create a Category template. When we have the
category-$slug.htmlfunctionality in the UI it would be ideal if the created template automatically used the block's from it's parent in the template hierarchy.mtias commentedon May 9, 2022
@getdave that's what #37258 aims for!
jameskoster commentedon May 16, 2022
Here's a couple of design options focussed on the process of creating templates that can be generic or specific. In this case creating
categoryorcategory-recipes.Option A
This one builds off the last concept but simplifies the UI down to just a radio list.
category-a.mp4
Option B
This one uses a two step process with more verbose descriptions.
category-b.mp4
mtias commentedon May 19, 2022
Option B looks like a good path to explore. I miss the extra helpful text we had here:
But tailored for what it means to add a template for a specific category slug, in this case.
ntsekouras commentedon May 19, 2022
I'll start exploring this, but with post types for start. We can always iterate on the POC I'll have soon and I guess the approach taken will be similar for taxonomies, etc..
@mtias you screenshot is a bit different from @jameskoster 's one. Is it more about the missing description?
My first thoughts for
postTypewould be a new menu item (if eligible) that would sayPost Typeand have two options:singletemplatesingle-post,single-project, etc...)jameskoster commentedon May 19, 2022
Yes I think so, we can add this in the PR.
To implement the design above consistently we'd have separate items per post type, and per taxonomy. As an example, if you had 'Products' as a CPT and 'Product categories' as a custom taxonomy then the add template menu would include:
Clicking "Single product" would ask if you want to add
single-productorsingle-product-$slugusing the "Option B" flow. Clicking "Product archive" would createarchive-product. Clicking "Product category" would ask if you want to addtaxonomy-product_catortaxonomy-product_cat-$slug, again using the flow in Option B.jorgefilipecosta commentedon Jul 4, 2022
Working on author-$nicename.
jorgefilipecosta commentedon Jul 5, 2022
author-$nicename ready for review at #37407.
ntsekouras commentedon Aug 25, 2022
All listed items have been merged.
Mamaduka commentedon Nov 18, 2022
I locked the conversations on this issue. Unfortunately, the last few comments look like spam.