Skip to content
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 template replace flow to template inspector #54562

Closed
richtabor opened this issue Sep 18, 2023 · 10 comments · Fixed by #54609
Closed

Site editor: Add template replace flow to template inspector #54562

richtabor opened this issue Sep 18, 2023 · 10 comments · Fixed by #54609
Assignees
Labels
[Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") Needs Design Feedback Needs general design feedback. [Status] In Progress Tracking issues with work in progress [Type] Enhancement A suggestion for improvement.

Comments

@richtabor
Copy link
Member

richtabor commented Sep 18, 2023

Twenty Twenty-Four is exploring adding alternate template types for the home, index, single and page templates. While the effort in #51477 brings alternate template selection to pages, templates still do not have this capability.

There's currently not a method for someone to swap a template directly with another templateType.

Current

Template swapping in the site editor, for pages:

CleanShot 2023-09-18 at 11 21 08

Proposed

If there are alternative templateTypes registered for a specific template, then surface the swapping functionality in the template inspector.

It could be in the verticalEllipsis menu (currently only there when customizations are present), or a button on the inspector, below the template's areas:

CleanShot 2023-09-18 at 11 38 07

I lean towards the verticalEllipsis method, as it's more in line with what we have in pages, and doesn't make it too surfaced. Eventually it'd be nice to see previews of the templates in the sidebar, but for a quick addition something like this seems simple enough.

@richtabor richtabor added [Type] Enhancement A suggestion for improvement. Needs Design Feedback Needs general design feedback. [Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") labels Sep 18, 2023
@richtabor
Copy link
Member Author

@ntsekouras pinging ya as you worked on the related PR.

@richtabor
Copy link
Member Author

Example: if you wanted to use a different archive template, you can't really — unless your theme does not already have one. For example, my theme here does not have an author archives template, so I can opt to create one, and when I do I am presented with archive template types to choose from.

I can't get back to that modal view (which could be populated with template types), to swap for another template, unless I delete the custom author archive template, and then re-add. But you can't delete a theme's templates.

cleanshot_2023-09-18_at_15 50 32_720
cleanshot_2023-09-18_at_15 51 16_720

@jameskoster
Copy link
Contributor

Resurfacing the pattern modal seems like a good way to get this in quickly, and the ellipsis approach could work well 👍

I'm not 100% sure about the "Swap template" label. It's a bit different to the "Swap template" action when page editing, so I don't know that matching is helpful. It's worth noting there's a similar pattern selection modal that appears when page authoring (if the right patterns exist), and we might want to resurface that one too.

Could something more generic like "Swap design", "Swap layout", or even "Swap pattern" work?

@richtabor
Copy link
Member Author

“Replace template”?

@jameskoster
Copy link
Contributor

Yeah that can work. It's consistent with "Replace template part" which is a similar flow.

@luminuu
Copy link
Member

luminuu commented Sep 19, 2023

+1 for "Replace template"

@scruffian
Copy link
Contributor

I made a start on this here: #54609

If anyone else wants to work on it be my guest...

@scruffian
Copy link
Contributor

If there are alternative templateTypes registered for a specific template, then surface the swapping functionality in the template inspector.

How is this achieved at present?

@scruffian
Copy link
Contributor

Oh I found it, you add:

Template Types: front-page, index, home

to a template...

@bph bph moved this from In Progress to Punted to 6.5 in WordPress 6.4 Editor Tasks Sep 28, 2023
@mtias
Copy link
Member

mtias commented Oct 3, 2023

I think ellipsis menu is super hidden. For reference, this is the design we had been working from for template parts: #44582

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") Needs Design Feedback Needs general design feedback. [Status] In Progress Tracking issues with work in progress [Type] Enhancement A suggestion for improvement.
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

5 participants