-
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: consider adding an option to clone an existing template when creating a new one #48377
Comments
Curious to hear from @WordPress/block-themers as well on this! |
This functionality would also be useful on template parts. |
I think there's an issue to introduce the "Duplicate template" option to the Template list page. cc @paaljoachim |
Duplicating template parts and $custom templates makes sense to me, but there's some nuance to duplicating/cloning the others. Perhaps I am overthinking (happens a lot), but allowing users to select an existing template as a base for the new one seems like it may be too blunt of an instrument. For example you'd never want to choose the 404 template as a base for the new single post template, and choosing something like the single template as a base for an archive makes no sense at all. If all templates are displayed as a 'clone' option then it creates a lot of opportunity for the user to accidentally create broken / unintuitive templates. It would be good to avoid that if we can find a way. For templates that are not $custom, perhaps we could expand the 'Choose a pattern' modal to include all existing compatible templates? The issue there is that I'm not sure if we have the APIs in place to determine that compatibility. cc @jorgefilipecosta as you've worked on this quite a bit. |
@jameskoster fair points. I do think being able to clone template parts would be great though. That said, this functionality reminds me a lot of duplicating/cloning pages and posts, something that has never been in Core and was relegated to plugin territory. I think the challenge in the case of templates and template parts is that there is no easy way (perhaps no way at all) to extend existing Site Editor functionality via a plugin. 🤔 |
Here is the duplicate template issue I made some time ago. Regarding duplicate as James also touches upon. There needs to be a way to figure out which templates can be duplicated and which do not have the ability to be duplicated. In general all template parts I believe should be able to be duplicated. |
I read this feedback not really about duplicating as an action but about being able to copy and replace a new template with the content of another template even if not directly related in the hierarchy. The most straightforward would be to show in the new template dialog a "what template do you want to base this on". If that modal is lacking, an action in the template inspector panel that says "Copy/replace from existing template" would be good. Right now you are forced to copy manually and paste manually, which takes a few steps. |
I suggest also this: A contextual menu dropdown (three dot) icon for every template (and template parts) in the list that appear in the left sidebar. A "Duplicate" voice inside this dropdown can start the flow, asking only for a new name. When "Duplicate" is not allowed , is greyed out. In this contextual menu we could put other actions, like "Clear customization", "Rename" ... |
There is a modal to choose the start of a template (fallback, blank, or a pattern related to the template). Could we extend the modal to have option like "Existing Template" that, when clicked, shows the existing templates (starting with the closest ones in the hierarchy)? |
It still seems unlikely to me that you'd want to mix different template types, IE create an archive template based on a singular one. But I suppose listing all and ordering by hierarchy could be a good place to start. We might need to consider the pattern angle here as well. If the modal contains all existing templates, plus patterns, it might need some simple filtering (maybe tabs) as there could be many thumbnails. |
When creating new templates, the following modal appears: It displays patterns associated with the template (if there are any), plus the closest existing template in the hierarchy. Perhaps we can augment this modal to include a way to clone existing templates? There could be tabs to choose between patterns or existing templates: |
Currently, when you're creating a new template in the Site Editor, you aren't able to pick and choose when template you'd like to clone, instead relying on fallback mechanisms. This was flagged as a current pain point in this post:
@jameskoster I could have sworn you had an issue for this exact thing but I cannot find it. It feels related to #41060 and the prior work in #37407
The text was updated successfully, but these errors were encountered: