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

Child Themes: template-parts links should include the child theme slug and not the parent theme slug. #275

Closed
matiasbenedetto opened this issue Mar 15, 2023 · 3 comments · Fixed by #301
Assignees
Labels
bug Something isn't working

Comments

@matiasbenedetto
Copy link
Contributor

matiasbenedetto commented Mar 15, 2023

When a template part is linked from a pattern it should have the theme key and it should contain the theme slug of the child theme.

Example:

<!-- wp:template-part {"slug":"header","theme":"childthemeslug"} /-->

Currently, when we export a child theme we use the parent theme slug and that avoids the template part to be loaded as expected in the editor causing the error: Template part has been deleted or is unavailable.

More info in this Gutenberg issue: WordPress/gutenberg#44243 particularly in WordPress/gutenberg#44243 (comment)

@miksansegundo
Copy link

Just noting that the same error Template part has been deleted or is unavailable reported in this issue also happens on themes that are exported with the "Clone" option.

Screenshot 2566-03-20 at 10 37 06

Updating the value of the theme key in the template-part to use the cloned or current theme slug didn't help in that case.

@matiasbenedetto
Copy link
Contributor Author

Updating the value of the theme key in the template-part to use the cloned or current theme slug didn't help in that case.

@miksansegundo I'm interested in this you mentioned. Did you try adding "theme":"yourthemeslug" ?

Could you attach the zip file obtained to help to debug?

@miksansegundo
Copy link

@matiasbenedetto here are the steps I followed:

  • Install and activate blank-canvas-3 theme
  • From the editor add a Front Page template
    • Add a Header template part
    • Edit the template part
  • Export the theme using CBT plugin with Clone option using the name Lodestar. See theme test.zip

Notice that CBT plugin exported a front-page pattern with the header template part using the value lodestar-3-wpcom in the theme attribute, which was unexpected:
<!-- wp:template-part {"slug":"header","theme":"lodestar-3-wpcom","tagName":"header"} /-->.

When I upload and activate the theme on a Jurassic site, I got the same error as in this issue. See screenshot:

Screenshot 2566-03-22 at 11 13 26

After updating the theme attribute to be "theme":"lodestar" or "theme":"blank-canvas-3" the error persisted.

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

Successfully merging a pull request may close this issue.

2 participants