Automattic / themes

Free WordPress themes made by Automattic for WordPress.org and WordPress.com.
https://themeshaper.com
GNU General Public License v2.0
900 stars 356 forks source link

Seedlet: Moar Extensibility #3134

Open georgestephanis opened 3 years ago

georgestephanis commented 3 years ago

When child theming seedlet, it'd be tremendously useful if there was a filter that the child theme could use to change which Google Fonts are pulled in (basically filtering the args before they're add_query_arg'd in here:

https://github.com/Automattic/themes/blob/06314c27f86c4f30a78f559eb82022e14a7d5f71/seedlet/functions.php#L307-L312

Also, if it would be possible to filter the default colors here:

https://github.com/Automattic/themes/blob/06314c27f86c4f30a78f559eb82022e14a7d5f71/seedlet/functions.php#L156-L162

that would far simplify things to match a site's branding without having to override a bunch of additional code.

Finally -- if possible, if there's a way for a child theme to add extra svg assets that could be loaded in via the Seedlet svg functions, it would provide a much more consistent devex -- but that's more wishlist.

** minor extra other bit: there's a bunch of very minor phpcs issues in Seedlet that the WordPress rulesets flag -- stuff like some conditionals not being 'yoda' style, or indenting style not being consistent or the like that may be worth tidying at some point, but that's not really bothering anyone apart from our build tools whenever we load it in to child theme.

<3

georgestephanis commented 3 years ago

Also noting here that for overriding the colors in a child theme, I did so like so:

/**
 * Create a "Colors Manager" class to short out the Seedlet colors customizer stuff.
 */
class Colors_Manager {}

/**
 * Hardcode the values.
 */
add_filter( 'theme_mod_custom_colors_active', '__return_null' );

add_filter( 'theme_mod_seedlet_--global--color-primary',    function() { return '#24446b'; } );
add_filter( 'theme_mod_seedlet_--global--color-secondary',  function() { return '#c3e0ec'; } );
add_filter( 'theme_mod_seedlet_--global--color-tertiary',   function() { return '#f4d03e'; } );
add_filter( 'theme_mod_seedlet_--global--color-foreground', function() { return '#1f1f1f'; } );
add_filter( 'theme_mod_seedlet_--global--color-background', function() { return '#ffffff'; } );