Closed oskosk closed 1 year ago
Seems like during the process of exporting, the theme
attribute is first removed here
eventually calling _remove_theme_attribute_in_block_template_content
here:
https://github.com/WordPress/create-block-theme/blob/031eee54a21e563e48b09e4dbc546138f36e5ad0/admin/class-create-block-theme-admin.php#L497
...and then added back here
via
This behavior was introduced in 1.6 with https://github.com/WordPress/create-block-theme/commit/6f0000205cee02cb9ab0e8f14873d07a5fb0a7ce as part of #213
Thanks, @oskosk for the detailed description of the problem. It seems like we are adding the theme key to the template part block in all the cases and it's only needed in some of them. I'll submit a potential fix shortly.
I’ve experienced this problem as well. It only seems to happen, when theme name is multiple words. Shortening theme name to one word fixed the problem.
This behavior was introduced in 1.6 with 6f00002 as part of #213
The problem is related to the fact that the characters used in the theme slug were not sanitized correctly, specifically the white spaces. That problem is pre-existent with those changes. Anyways is a good opportunity to fix this bug and simplify the code a little. A potential fix: #244
Alright , thanks! Note that after reporting this issue I continued working with 1.5.1 the whole day without experiencing the issue. Also with a theme using a name with spaces
Note that after reporting this issue I continued working with 1.5.1 the whole day without experiencing the issue. Also with a theme using a name with spaces
Yep, but that's because in 1.5.1 in we remove the theme key in the template parts linked from templates. In 1.6.0 no, so the template parts were linked like this (following your example theme name): "theme":"le theme"
instead of "theme":"letheme"
More reports from the Create Block Theme forum: https://wordpress.org/support/topic/bug-exporting-templates-uses-wrong-theme-key/
The fix (#244) was merged and released in version 1.6.1 of the plugin. It should be working as expected now.
Thank so much @matiasbenedetto
Hello, @matiasbenedetto This issue was fixed in 1.6.1, but it seems to happen again in 1.6.2.
I faced the same issue when I export, clone, overwrite the TT3 theme.
This recent refactor #237 wiped out the fix added in #244, that's the reason for this issue happening again in 1.6.2. I'm adding again the changes from #244 to #259.
This issue was fixed in 1.6.1, but it seems to happen again in 1.6.2.
This regression should be fixed in the 1.6.3 version.
It's fixed and works fine on version 1.6.3. Thank you!
Hi, I am having the same issue with version 1.9.0.
I have Spectra One Theme installed and am using the Spectra Plugin so I do not know if it maybe is related to those. After creating a child theme from Spectra One with the Create Block Theme plugin I get the same error message about missing or deleted header and footer. Manually removing template parts and adding new ones pointing to header and footer fixed the issue.
Also the preview picture of the theme is missing in the themes overview, after creating the child theme.
Apart from that everything is working flawlessly as fas as I can see.
Best Sascha
Also having problems with 1.13.1 and Wordpress 6.2.2. And in my case changing the theme name in htmls didn't help.
I'm getting confused where the template parts with changes are actually stored - is it the html files, is it the database ... together with using WPML for translation this is getting a bit out of hands.
I am still getting the issue of "Template part has been missing or unavailable". I am on WP 6.2 with the create block theme version 1.13.1. I tried with Spectra and blockbase theme, same error.
I have the same issue now in 1.13.8
While working on a theme created from scratch with Create Block Theme I opted to export the theme using the Export the activated theme with user changes option:
I got a zip bundle and uploaded to another site. On that new site I visited the editor and was shown a message
Template part has been deleted or is unavailable: header
(footer as well).Workaround
I noticed then that the
templates/index.html
file part of the bundle created by the export was referring to the header part like this:... while my original file (the one generated from scratch) read:
After removing
"theme":"new blank theme"
the template worked properly loading the index part.How to reproduce
Template part has been deleted or is unavailable: header
andTemplate part has been deleted or is unavailable: footer
messages.