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

Template Part Block: Load content from the parent theme if there no template in a child theme #33846

Closed
wants to merge 1 commit into from

Conversation

scruffian
Copy link
Contributor

Description

If a child theme wants to modify a template from a parent theme, it will then need to redefine the header and footer template parts. With this change the theme will fall back to the parent theme template unless the child theme defines it. With this change child themes will be able to be much simpler.

How has this been tested?

With Skatepark: https://github.com/Automattic/themes/tree/7e8706ed7f703aacbbe00b9a1b182b2f2cede76e/skatepark

With this change, Skatepark won't need to redefine header and footer template parts, it will inherit the ones in Blockbase.

Types of changes

New feature (non-breaking change which adds functionality)

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • I've tested my changes with keyboard and screen readers.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR (please manually search all *.native.js files for terms that need renaming or removal).

@scruffian scruffian added the [Block] Template Part Affects the Template Parts Block label Aug 3, 2021
@scruffian scruffian self-assigned this Aug 3, 2021
@Mamaduka
Copy link
Member

Mamaduka commented Sep 8, 2021

Hi, @scruffian

I created PR to bring essential child theme support for FSE - #34354. PR also takes a slightly different approach to handle this case.

Your feedback would be much appriciated.

Thanks

Copy link
Contributor

@carolinan carolinan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is working well for me.

  • The child theme displays the parent theme template parts in the editors and front.
  • The parent theme template part can be overwritten by adding a new template part in the child theme.

@carolinan
Copy link
Contributor

#34354 also works well so it depends on which is the preferred approach.

@Mamaduka
Copy link
Member

#34354 got merged, which should handle template overrides.

@Mamaduka Mamaduka closed this Sep 22, 2021
@scruffian scruffian deleted the update/template-part-lookup branch September 24, 2021 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Template Part Affects the Template Parts Block
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants