You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Blockbase supplies a collection of fonts via theme.json.
In order for child themes to ALSO supply these same fonts they do NOT supply ANY fonts via theme.json. (If they did then ONLY the fonts supplied by the child theme would be available.)
Jetpack supplies a collection of fonts via Webfont Provider.
In Gutenberg the fonts provided by Jetpack are added to the "theme data" (in get_theme_data()) via a call to gutenberg_add_registered_webfonts_to_theme_json().
These fonts are added to the CHILD theme's "theme data". Thus (as noted above) those are the ONLY fonts that are now available. Therefore the fonts provided by the parent (Blockbase) aren't available and only those supplied by Webfont Providers (Jetpack) are.
Solutions considered:
Only add the fonts to the PARENT theme when processing in get_theme_data(). This works for the scenario of Blockbase (where child themes are expected to NOT supply any additional fonts). However in other potential scenarios if a child theme DOES supply fonts these additional fonts will NOT be included (since those fonts in the "child" theme data override those in the "parent")
Combine the fonts provided by the parent and child rather than using ONLY the parent (if the child supplies none) or the child (if it supplies some).
Do not add the fonts which have been added via webfont providers to theme data. Perhaps this collection could be added in a different way.
I'm not sure that any of these fixes can actually be accomplished with changes to Blockbase. The only possible solution Blockbase could offer would be to include those fonts via a Webfont provider instead of via theme.json. And since Blockbase has already made these fonts available to users who are NOT using the Gutenberg plugin this can only be accomplished once that capability is in CORE.
The text was updated successfully, but these errors were encountered:
pbking
changed the title
Blockbase fonts are clobbered in Child themes
Fonts provided by a parent theme are clobbered by fonts provided via Webfont Provider
Jan 18, 2023
The following is happening:
Blockbase supplies a collection of fonts via theme.json.
In order for child themes to ALSO supply these same fonts they do NOT supply ANY fonts via theme.json. (If they did then ONLY the fonts supplied by the child theme would be available.)
Jetpack supplies a collection of fonts via Webfont Provider.
In Gutenberg the fonts provided by Jetpack are added to the "theme data" (in
get_theme_data()
) via a call togutenberg_add_registered_webfonts_to_theme_json()
.https://github.com/WordPress/gutenberg/blob/trunk/lib/class-wp-theme-json-resolver-gutenberg.php#L249
These fonts are added to the CHILD theme's "theme data". Thus (as noted above) those are the ONLY fonts that are now available. Therefore the fonts provided by the parent (Blockbase) aren't available and only those supplied by Webfont Providers (Jetpack) are.
Solutions considered:
get_theme_data()
. This works for the scenario of Blockbase (where child themes are expected to NOT supply any additional fonts). However in other potential scenarios if a child theme DOES supply fonts these additional fonts will NOT be included (since those fonts in the "child" theme data override those in the "parent")I'm not sure that any of these fixes can actually be accomplished with changes to Blockbase. The only possible solution Blockbase could offer would be to include those fonts via a Webfont provider instead of via theme.json. And since Blockbase has already made these fonts available to users who are NOT using the Gutenberg plugin this can only be accomplished once that capability is in CORE.
The text was updated successfully, but these errors were encountered: