Skip to content

Error: "Template part has been deleted or unavailable:header". #429

Closed

Description

@ashrudral

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.
Screenshot 2023-07-28 163829

How to recreate the error:

  1. Install blockbase theme on fresh WP site version 6.2.2
  2. Install create block theme plugin
  3. create child them with only 1 word name for child theme.
  4. download child zip
  5. upload child theme zip
  6. activate theme
  7. 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.

Activity

  1. bystrzan commented on Aug 27, 2023

    @bystrzan

    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.

  2. ashrudral commented on Aug 27, 2023

    @ashrudral
    Author

    Just want to mention again that:

    1. I am using single word name. My child theme name: "Blockbasechild"
    2. 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.

  3. bystrzan commented on Aug 28, 2023

    @bystrzan

    @ashrudral

    1. So this is not a problem (theme name / slug)
    2. 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.
    3. 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:
    <!-- 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:

  4. pbking commented on Sep 20, 2023

    @pbking
    Contributor

    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

  5. t-hamano commented on Jan 7, 2024

    @t-hamano
    Contributor

    Now that WordPress/gutenberg#54595 has been merged, can we close this issue?

  6. mikachan commented on Jan 8, 2024

    @mikachan
    Member

    Now that WordPress/gutenberg#54595 has been merged, can we close this issue?

    Yes, I think so! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions