Proof of concepts for pre-populating / overriding / disabling the customizer in WordPress child themes.
Demo child theme for Themegrill - Flash MultiPurpose WordPress Theme.
I pitched for a job where the client wanted to override the theming options provided by the Flash theme.
change the hero font and color to something that reads better ... No coding should be required. The deliverable I am looking is a theme zip file that can be installed in any wordpress site, and the CSS changes/additions on a separate file.
In Flash as in WordPress, colours and fonts are specified using the WordPress customizer: Appearance > Customise.
It sounded like the client wanted to set these values without using the customiser, so that the changes could easily be replicated to any wordpress site.
The WordPress Customizer is helpful for:
- clients without coding knowledge
- clients who want to set up 'unique' themes quickly
The WordPress Customizer is unhelpful for:
- clients who will refactor their parent theme customisations into a child theme one day (see: Make WordPress Core - Child theme does not inherit previous customizer settings from parent theme)
- clients who want to avoid repetition when setting up clone sites
I thought of several solutions to this:
- Ignore whatever value is set in the customizer by overriding the output in a child theme
- makes the customizer live preview inaccurate
- could be confusing for authors
- Remove the customizer options and hardcode the preferred settings in a child theme's stylesheet
- requires WET code to duplicate the dynamic inline CSS from the parent theme to the child theme
- removes functionality that might be useful in some cases
- Retain the customizer options but override the defaults with your own in a child theme
- customise existing functionality rather than overriding it
- CSS Custom Properties could be used to expose these defaults to the child theme CSS to keep these DRY
- Use a WordPress Plugins - Customizer Export/Import plugin to set your preferred customizer settings then export these to a file
- file could be committed to version control
- quickly load your preferences when setting up a site
- still be a manual process.
- Implement one of the above options in a plugin instead, if a child theme is already in use
- Change to a different theme/framework that is less opinionated about how theming is managed
- Change the customizer colour palette to one of your own (this doesn't address the font issue):
- Intelliwolf - How To Change The Default Colors In WordPress Customizer
- Github - Automattic Iris Color Picker - initialised in
wp-admin/js/color-picker.js
- BeaverBuilder - Add color presets to Customizer - re-initialise Iris
Flash uses the Kirki WordPress Customizer Framework. This is a wrapper for WP_Customize_Manager.
The documentation for the theme is non-technical. You need to go dig into the PHP files to see what's possible.
- Github - Kirki repository
- Ralph J. Smit - Beginners guide for the Kirki customizer framework
- Ralph J. Smit - How to use the Kirki typography control: custom fonts & Google
- Kirki - Default value in get_theme_mod function
- Kirki - Removing fields via a child theme
- Kirki - Missing remove_panel, remove_section, remove_field
See TODO
s in files.