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

FSE: Can't add new templates as per template hierarchy #32861

Closed
chandrapatel opened this issue Jun 21, 2021 · 11 comments
Closed

FSE: Can't add new templates as per template hierarchy #32861

chandrapatel opened this issue Jun 21, 2021 · 11 comments
Labels
[Feature] Template Editing Mode Related to the template editor available in the Block Editor [Status] Needs More Info Follow-up required in order to be actionable. [Status] Stale Gives the original author opportunity to update before closing. Can be reopened as needed.

Comments

@chandrapatel
Copy link

chandrapatel commented Jun 21, 2021

Description

I was trying to add archive page template for custom post type archive-{post_type}.html from Site Editor but there is no option. Add new template option only for Front Page, Page, Author, Category, Date, Tag, Single item: Post and Custom template.

I have tried using Custom template but it only applied to any single post or page.

Another example is that I can add new template for Category which applies to all category terms but I can't add new template for specific term using slug (category-$slug.html) or ID (category-$id.html) as per the template hierarchy.

I can add templates as per hierarchy in block theme and it's working, and I can edit in Site Editor.

I don't know if there is planning to add more new template options as per template hierarchy. I believe more template options will help user to add new templates for specific content type.

Step-by-step reproduction instructions

  1. Go to Appearance -> Editor.
  2. Click on WordPress Logo to open left sidebar.
  3. Click on Templates to see list of templates.
  4. Click on Add New button which shows list of template types.

Expected behaviour

User able to add new templates as per template hierarchy.

Actual behaviour

User unable to add new templates as per template hierarchy.

Screenshots or screen recording (optional)

WordPress information

  • WordPress version: 6.0.1
  • Gutenberg version: 13.7.2
  • Are all plugins except Gutenberg deactivated? Yes
  • Are you using a default theme (e.g. Twenty Twenty-Two)? Yes

Device information

  • Device: Desktop
  • Operating system: macOS
  • Browser: Microsoft Edge 103 (Chromium)
@carlomanf
Copy link

I think this was fixed by #31971, which is not merged as yet. I encourage you to test again with that branch as I'm curious whether it does fix this.

@chandrapatel
Copy link
Author

Hi @carlomanf I have cloned your repo, checkout to try/fse-theme-mods branch and ran npm install && npm run build commands. When I try to add new template or template-parts then it shows white screen. I have checked but couldn't find any reason. I have followed same steps for main repo and trunk branch and it's working.

I don't know what the issue could be. Let me know if I'm missing anything. Thanks.

@carlomanf
Copy link

Thanks for testing @chandrapatel. After reading again, I think I misunderstood what your issue is about.

There are kind of two different issues here:

  1. The slug can't be changed for an already existing template
  2. A brand-new template can't be created with a specifically desired slug

Am I correct that you're more concerned about number 2 than number 1?

@chandrapatel
Copy link
Author

Hi @carlomanf Yes, that's correct. I'm also concerned about number 1 issue.

@annezazu annezazu added [Block] Template Part Affects the Template Parts Block [Feature] Template Editing Mode Related to the template editor available in the Block Editor [Type] Bug An existing feature does not function as intended Needs Design Needs design efforts. labels Jul 28, 2021
@optimizewp
Copy link

optimizewp commented Nov 14, 2021

This issue is still actual, tested with both WP 5.8.2 and 5.9-alpha-52142, and with Gutenberg 11.9.0 while testing for FSE Program Testing Call #11: Site Editing Safari.

No Template slug can be edited, existent or not, in reply to @carlomanf, and neither if associated with the theme in use or not.

The same is true for the "Templates Parts" /wp-admin/edit.php?post_type=wp_template_part.

Curious about this, I also checked the "Navigation Menu" /wp-admin/edit.php?post_type=wp_navigation, all fine with them, after the slug has been flagged for visibility in its own "Screen Option" settings when editing one, it can be succesfully updated.

Please be aware that to be sure the change happened or failed, you need to reload the page of the template you're trying to edit, beacuse after the Update action it seems the new assigned slug stuck.


Related tickets that dealt with this slug:


Testing Enviroment
Wordpress: 5.8.2 & 5.9-alpha-52142
Gutenberg: 11.9.0
Windows 10 21H1 (OS Build 19043.1348)
Local Install: Laragon, apache httpd-2.4.51-win64-VS16, php-8.0.12-nts-Win32-vs16-x64, mysql-8.0.27-winx64
Browser: Microsoft Edge - Version 95.0.1020.44 (Official build) (64-bit)

@annezazu
Copy link
Contributor

Related issue just opened :) #37407

@carolinan
Copy link
Contributor

Hi!

The Appearance -> Templates screen does not exist anymore.

The template list in the Site Editor has an option for renaming the template. It does not separate "name" and "slug", it only has one option, and the option is only for user created templates:

Template list, with the option for renaming the selected template

@chandrapatel Are you able to update the issue to match the current UI and template editing experience, and clarify the uses cases for needing to update template slugs? Is it still needed or is the existing option enough?

@carolinan carolinan added [Status] Needs More Info Follow-up required in order to be actionable. and removed [Type] Bug An existing feature does not function as intended Needs Design Needs design efforts. [Block] Template Part Affects the Template Parts Block labels Jul 25, 2022
@chandrapatel chandrapatel changed the title FSE: Can't update slug for custom template and template parts FSE: Can't add new templates as per template hierarchy Jul 26, 2022
@chandrapatel
Copy link
Author

Are you able to update the issue to match the current UI and template editing experience, and clarify the uses cases for needing to update template slugs? Is it still needed or is the existing option enough?

@carolinan I have updated issue title and description. Previously I thought it might be possible if user can update template slug to add new templates as per template hierarchy but now there is no option to add/update template slugs. Only can rename template name.

Original issue was to have options to add new templates as template hierarchy so that user can have different template for different content types like different archive template for custom post types or template for single category term, etc.

@github-actions
Copy link

Help us move this issue forward. This issue is being marked stale since it has no activity after 15 days of requesting more information. Please add info requested so we can help move the issue forward. Note: The triage policy is to close stale issues that need more info and no response after 2 weeks.

@github-actions github-actions bot added the [Status] Stale Gives the original author opportunity to update before closing. Can be reopened as needed. label Aug 11, 2022
@ntsekouras
Copy link
Contributor

@chandrapatel do you think we can close this one in favor of #37407? The only template type that is missing right now is the archive-$postType and has a PR already.

@chandrapatel
Copy link
Author

@ntsekouras Yes, we can close this issue. I'm closing it. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Template Editing Mode Related to the template editor available in the Block Editor [Status] Needs More Info Follow-up required in order to be actionable. [Status] Stale Gives the original author opportunity to update before closing. Can be reopened as needed.
Projects
None yet
Development

No branches or pull requests

6 participants