-
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: Browsing sidebar templates menu restructure #28291
Site Editor: Browsing sidebar templates menu restructure #28291
Conversation
For now, here's what I think we should probably do:
Here's a visual rendition of that: I'm sure that in the future we can refine the sections, but I think this would be a good place to start. |
6abcd28
to
33ff608
Compare
Size Change: +3.12 kB (0%) Total Size: 1.39 MB
ℹ️ View Unchanged
|
966cca3
to
2779c31
Compare
One thing that tripped me up a bit is the custom It's worth remembering that custom templates can be restricted to specific post types, or made available to a set of post types, including CPTs. [Docs] The Then, the "Page templates" and "Post templates" sections are reserved for templates that target a specific page or post. |
Moved |
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.
This is working nicely for me!
One thing I started noticing lately, that's not related to this PR, are the template descriptions containing the "is queried" phrase. I don't think it explains much to the user and it's only going to add confusion.
} | ||
|
||
if ( | ||
slug.startsWith( 'post-' ) || |
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 we can isolate these to an array similar to TEMPLATES_TOP_LEVEL
?
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.
Good idea! Thanks!
I'd just noticed it too, but somebody was ahead of us: #29531 |
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 from my end, I think we still need an to check if 'home' is superseded though?
packages/edit-site/src/components/navigation-sidebar/navigation-panel/template-hierarchy.js
Outdated
Show resolved
Hide resolved
One thing that jumped to mind when reviewing is the |
Just to clarify why the single-post template was added: Even with updated descriptions, the Single and Singular (in particular) templates are a little ambiguous. I worry that it's a lot to ask of users to understand that the single template will resolve not only for posts, but for any single CPT entries as well. An option to add an explicit template for pages exists, I think it stands to reason that there also be a corresponding option for posts. |
It's not a template that is used frequently on themes because "single" covers most of the needs, and any other more specific custom post type gets its own template if needed. Having both "single" and "single-post" is more confusing. We could have the name "Single Post" on |
I think that would help people who are not familiar with the wp template hierarchy. The trade-off is that users will have to exercise some doublethink in order to understand that the "Single Post" template is for single Posts (as in single entries of the |
I agree, I'm fine with removing the As for what to call the "Single" template, I think "Single Post" (or even just "Post" to correspond with the "Page" template nomenclature) seems okay. It is kind of confusing that that template might be used for CPT entries too, but I'm not sure it's more confusing than having the current state of affairs (where the vaguely-named "Single" template does that). |
🤔 "Single Entry", "Single Item"... 🤷♀️ |
Hah, the idea of adding "Post" to the name is to make it intuitive for people to add a template that displays a single blog post. "Single" alone doesn't describe that very well. I suppose the description helps with the doublethink situation a bit?
Having to include that "Or a single post of any other type" bit really bugs me, but I'm struggling to think of an alternative, if we want to get rid of single-post. |
Maybe 'custom' would fit better than 'other' ? At least trying to think as a new user 'custom' seems more like something i dont necessarily need to worry about, but 'other' type might make me a little concerned that I don't know what the other types are! 😆 "Template used to display a single blog post, or a single post of any custom type" |
Another idea (probably asking too much here but let's at least rule it out) would be to make the description dynamic, and explicitly list which post types it will resolve for. So if the following public post types exist:
And the following templates exist:
The description for the Single template would read:
If you then deleted the
We might do something similar for the Singular template. |
This sounds like a good candidate for a follow-up, what ya'll think? 😄 We can go ahead and merge this if you don't have any blockers here. |
I think that's fair. This looks good from the design side. |
Sorry for derailing the conversation :) |
Description
home
,index
,singular
) goes to unused menupage-home
is an exception, it's set to shown up in GeneralUnused templates
Q: Why only
home
,index
andsingular
can be in the Unused templates menu?We wanted to keep it simple and only primary and secondary templates are moved to Unused menu. Hiding unused templates accurately would be extremely difficult.
Only 3 templates met these conditions:
home
met the conditions because it is considered unused if:front-page
template existsindex
met the conditions because it is considered unused if:archive
,404
,search
template existsingle
andpage
exist ORsingular
exists)home
exists OR superseded byfront-page
OR custom page shown on front)singular
met the conditions because it is considered unused if:single
andpage
template existHow has this been tested?
post-*
,author-*
,single-post-*
,tag-*
show up herepage-*
show up here$custom
shows up herehome
,index
, and/orsingular
shows up here if conditions are metScreenshots
Screen.Recording.2021-02-17.at.16.06.23.mov
Types of changes
New feature (non-breaking change which adds functionality)
Checklist: