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

Template name does not display properly when a theme.json is present #47428

Open
emilyatmobtown opened this issue Jan 25, 2023 · 4 comments
Open
Labels
[Block] Template Part Affects the Template Parts Block [Type] Bug An existing feature does not function as intended

Comments

@emilyatmobtown
Copy link

Description

I expect the page template title to display in the sidebar Summary panel when I select a new custom page template. If I don't have a theme.json in my theme, this works as expected.

If I do have a theme.json in my theme, the template title displays Default template instead of the custom page template title.

This happens if I add a template in the customTemplates array in theme.json – or if I use a classic PHP template and don't include it in a customTemplates array in the theme.json.

Step-by-step reproduction instructions

  1. Add a page template to any theme without using a theme.json.
  2. Create a new post.
  3. In the sidebar Summary panel, click "Default template" and select the custom page template in the modal.
  4. Close the modal and see that the new page template title is displayed instead of "Default template".
  5. Add a basic theme.json to the theme.
  6. Create a new post.
  7. In the sidebar Summary panel, click "Default template" and select the custom page template in the modal.
  8. Close the modal and see that the new page template title is not displayed. See that the template title still says "Default template".

Screenshots, screen recording, code snippet

The page template is selected in the modal, but "Default template" still displays as the template title in the Summary panel. This theme has a theme.json.
Screen Shot 2023-01-25 at 12 34 37

Environment info

  • WP 6.1.1, any theme
  • Gutenberg version 14.1

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@kathrynwp kathrynwp added [Block] Template Part Affects the Template Parts Block [Type] Bug An existing feature does not function as intended labels Jan 25, 2023
@carolinan
Copy link
Contributor

Hi! I believe this is a duplicate of #41449 ?

@emilyatmobtown
Copy link
Author

Hi! I believe this is a duplicate of #41449 ?

@carolinan No, I believe that's different. It looks like #41449 is a suggestion for UX improvement. This is a bug. The template title displays as expected when there's no theme.json. But when there's a theme.json, the template title displays "Default template" no matter what template is selected.

@emilyatmobtown
Copy link
Author

In the logic, it appears that there's an assumption that, if there's a theme.json, then it's a block theme and therefore using the wp_template post type to store templates. When that's not found, then "Default template" is displayed rather than picking up the template title from the file in the theme or from the theme.json.

@corentin-gautier
Copy link
Contributor

Just stumbled upon this issue as well on a production website for a client

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Template Part Affects the Template Parts Block [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

4 participants