Make WordPress Core

Opened 20 months ago

Closed 3 weeks ago

Last modified 2 weeks ago

#57289 closed defect (bug) (worksforme)

Allow child themes to use template parts from parent themes in Full Screen Editor

Reported by: catacaustic's profile catacaustic Owned by:
Milestone: Priority: normal
Severity: normal Version: 6.1.1
Component: Editor Keywords: close
Focuses: Cc:

Description

Creating template parts in a theme for the Full Site Editor does not allow template parts from a parent theme to be used by a child theme. These will show when editing a template, and allow you to insert/update/delete them when editing templates, but an error message shows on the public-facing page - "Template part has been deleted or is unavailable: *template-name*".

All that is needed is an additional check if a child theme is active and if so check against the parent theme as well as the child theme.

Attachments (1)

1l3Zto9h.diff (249 bytes) - added by catacaustic 20 months ago.
Diff file

Download all attachments as: .zip

Change History (7)

@catacaustic
20 months ago

Diff file

#1 @catacaustic
20 months ago

Sorry, missed which file this applies to -

wp-includes\blocks\template-part.php

This ticket was mentioned in Slack in #core-test by ironprogrammer. View the logs.


20 months ago

#3 @ironprogrammer
20 months ago

  • Keywords reporter-feedback added

Welcome back to Trac, @catacaustic, and thanks for the report!

This issue looks similar to https://github.com/WordPress/gutenberg/issues/44243, where a workaround was to remove the theme name from <!-- wp:template-part -->. For instance, change:

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

to

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

Would you mind testing to see if this also fixes the errors you're seeing? Your proposed patch may offer a solution there as well. Thank you!

#4 @poena
4 weeks ago

  • Keywords close added

I am not able to reproduce it using WordPress 6.6 RC2.
I am able to insert the parent theme template parts in the Site Editor without editing any code manually, and they work in the editors and the front.

I recommend closing this as fixed.

#5 @ironprogrammer
3 weeks ago

  • Keywords reporter-feedback removed
  • Resolution set to fixed
  • Status changed from new to closed

I am also unable to reproduce an error against trunk (6.7-alpha-58576-src) with a TT4 child theme using prebuilt templates. In my tests the parent templates are available to the child theme, and when assigned no error occurred on the frontend. (Also noting here that custom templates created for the parent are not visible to the child theme in the site editor, in case this was a nuance of the original report.)

I'm marking this closed, but if the issue remains and some additional context can be provided to reproduce the error, please feel free to reopen the ticket for further investigation.

#6 @desrosj
2 weeks ago

  • Milestone Awaiting Review deleted
  • Resolution changed from fixed to worksforme
Note: See TracTickets for help on using tickets.