You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Error: "Template part has been deleted or unavailable:header". #429
I am still getting the issue of "Template part has been deleted or unavailable:header".
Objective: create child theme of blockbase and spectra.
Wordpress: I am on WP 6.2
create block theme version 1.13.1.
How to recreate the error:
Install blockbase theme on fresh WP site version 6.2.2
Install create block theme plugin
create child them with only 1 word name for child theme.
download child zip
upload child theme zip
activate theme
Go to site, following error:
"Template part has been deleted or unavailable:header".
"Template part has been deleted or unavailable:footer".
This error is there in many more places such as icons meta, post meta, etc.
There's a problem with handling the template parts - You can easly fix it by adding to the frontpage.html "theme name / slug", so get header part will look like:
Ofcourse you should update it also in DB by switch to show code and replace exported - buggy version of those lines.
Same for any other template part. I found that this problem isn't always the problem with Create Theme Plugin, but mostly when theme has a name where 2 or more words, or / and template part has own pattern inside.
The above fix is quickfix / hotfix for developers that already creating the themes with this plugin.
I am using single word name. My child theme name: "Blockbasechild"
The parent theme is Blockbase.
Thank you for your response. Indeed, It must be a pattern inside the parent theme causing error. The quick fox you provided, I don't fully understand where to insert that snippet?
Luckily, I was able to manually create a child theme by creating a style.css and function.php file in the child theme folder and it is working for me.
It doesn't matter what theme it is - the problem is that while exporting changes from DB to the theme frontpage.html the CBT plugin often miss some part of code that should be included to get global template parts to work.
Steps to fix the problem (each time you export or save changes to the theme files):
A) Go to edit your Front Page in Editor and in the top right corner click 3 dots menu and click on "Code Editor".
B) Open frontpage.html in code editor on your computer and:
for A & B replace first and last lines - like here:
This is the issue to watch. Rendering a template-part from a pattern doesn't work as it should unless you include the theme attribute, however including the theme attribute means that the theme HAS to be installed at the "top level" of the /theme folder which isn't always the case. Thus rendering correctly without the theme attribute is the fix to make. In the meantime I suggest avoid using template parts in patterns.
Activity
bystrzan commentedon Aug 27, 2023
There's a problem with handling the template parts - You can easly fix it by adding to the frontpage.html "theme name / slug", so get header part will look like:
<!-- wp:template-part {"slug":"header","theme":"YOUR_THEME_SLUG","tagName":"header"} /-->Ofcourse you should update it also in DB by switch to show code and replace exported - buggy version of those lines.
Same for any other template part. I found that this problem isn't always the problem with Create Theme Plugin, but mostly when theme has a name where 2 or more words, or / and template part has own pattern inside.
The above fix is quickfix / hotfix for developers that already creating the themes with this plugin.
ashrudral commentedon Aug 27, 2023
Just want to mention again that:
Thank you for your response. Indeed, It must be a pattern inside the parent theme causing error. The quick fox you provided, I don't fully understand where to insert that snippet?
Luckily, I was able to manually create a child theme by creating a style.css and function.php file in the child theme folder and it is working for me.
bystrzan commentedon Aug 28, 2023
@ashrudral
this:
<!-- wp:template-part {"slug":"header","tagName":"header"} /-->with: ↓
<!-- wp:template-part {"slug":"header","theme":"blockbasechild","area":"header"} /-->and this:
<!-- wp:template-part {"slug":"footer","tagName":"footer"} /-->with: ↓
<!-- wp:template-part {"slug":"footer","theme":"blockbasechild","area":"footer"} /-->You can read more about this bug here:
pbking commentedon Sep 20, 2023
This is the issue to watch. Rendering a template-part from a pattern doesn't work as it should unless you include the theme attribute, however including the theme attribute means that the theme HAS to be installed at the "top level" of the /theme folder which isn't always the case. Thus rendering correctly without the theme attribute is the fix to make. In the meantime I suggest avoid using template parts in patterns.
WordPress/gutenberg#53194
t-hamano commentedon Jan 7, 2024
Now that WordPress/gutenberg#54595 has been merged, can we close this issue?
mikachan commentedon Jan 8, 2024
Yes, I think so! 🎉