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

Custom templates are renamed after overwriting theme #184

Open
hanneslsm opened this issue Jan 24, 2023 · 6 comments
Open

Custom templates are renamed after overwriting theme #184

hanneslsm opened this issue Jan 24, 2023 · 6 comments
Labels
bug Something isn't working

Comments

@hanneslsm
Copy link

  1. Create a new theme
  2. Customize it
  3. Create a new Template, let's say "Page - Single"
  4. Save all changes with the Create Block Theme Plugin with the Overwrite Function.

The names of the custom template has changed.
image

FYI: The template parts have changed to all lowercase, which I like. Don't know if this is on purpose though.

@mikachan mikachan added the bug Something isn't working label Jan 24, 2023
@jffng
Copy link
Contributor

jffng commented Feb 3, 2023

I think we would need to add a definition to theme.json's customTemplates if we wanted to preserve the name of the new template.

@franzaurus
Copy link

I still experience it on Create Block Theme 1.6.0.

Environment:

  • with or without Gutenberg 15.2.0 active
  • WP 6.1.1

template-name-back-to-slug

@hanneslsm
Copy link
Author

Still exists with WP 6.3 RC2, Create Block Theme 1.13.1

How can we get some movements in this issue? I'd love to help (can't code though) but let me know if there's anything design-wise I could do.

@TonyGravagno
Copy link

In WP production 6.3 (no additional CBT plugin) Create a child theme from TT3, and wp-admin/site-editor.php?path=%2Fwp_template%2Fall shows the file names as the Template name. Is this related to this ticket?

image

The next screenshot shows the file system folders of TT3 (files unchanged since install) and the child theme folder.

image

The wp-custom-template files are in the zip that is exported from the template editor:

image

Export/Import seemed to be required, as when the child theme is active the templates are still in the database, but no longer available for use by a different theme - that makes sense.
But it seems that when these template files are imported, there is no post_title metadata for a pretty name, so the filename is used in the UI instead.

Suggestion : Include metadata in the Export and process it in the import when creating new post records. At some point that will probably be a good idea anyway.

@audunmb
Copy link

audunmb commented Feb 1, 2024

Work-around:

Go into the theme.json of your saved/exported theme file (or child theme). Add the following at top level (same level as "settings"):

"customTemplates": [
		{
			"name": "wp-custom-template-name-of-template",
			"postTypes": [
				"page", 
				"post"
			],
			"title": "Name of template"
		},
		{
			"name": "wp-custom-template-name-of-another-template",
			"postTypes": [
				"page", 
				"post"
			],
			"title": "Name of another template"
		}

	],

postTypes doesn't seem to have any effect, but change it anyway.

@Peter-HVD
Copy link

@audunmb's workaround is great, but is there any chance this is going to get fixed as it's driving me nuts!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants