bobbingwide / wizzie

Experimental WooCommerce Full Site Editing child theme of Fizzie
GNU General Public License v2.0
0 stars 0 forks source link

Develop template-part override to support child and parent themes #4

Open bobbingwide opened 3 years ago

bobbingwide commented 3 years ago

To resolve the Template part has been deleted messages I added functions.php copied from Fizzie, significantly reduced to:

The template-part block override implements support for loading the template parts from the child theme ( get_stylesheet_directory() ) then the parent theme ( get_parent_directory() ), if no custom version is found in the database.

I also eliminated the call to _gutenberg_inject_theme_attribute_in_content(). I need to check if this was actually necessary.

Originally posted by @bobbingwide in https://github.com/bobbingwide/wizzie/issues/1#issuecomment-858083829

bobbingwide commented 3 years ago

I need to check if this was actually necessary.

The first version of the logic worked for top level template parts but didn't for template parts embedding other template parts without specfiying the theme attribute.

The fix for this was to set $attribute['theme'] to the theme name if it was not already set. Now I need to tabulate what we expect to happen and compare this with the results. This may be different from how Gutenberg currently does it.

Note: The Site Editor is unable to load template-parts if they are identified by the parent theme name, even if the template parts are available in the child theme. See #3