Replies: 0
Hi there,
based on 2017 I created a child theme with a variant of the dark theme.
To have everything neatly separated I set up a hack in the customizer to allow me a separate color theme. I am looking to replace this hack as it needs to be reapplied for every update of WP or the 2017 theme.
Steps
– in twentyseventeen/inc/customizer.php add the theme as option (lines 44-54)
ˋˋ$wp_customize->add_control( ‘colorscheme’, array(
‘type’ => ‘radio’,
‘label’ => __( ‘Color Scheme’, ‘twentyseventeen’ ),
‘choices’ => array(
‘light’ => __( ‘Light’, ‘twentyseventeen’ ),
‘dark’ => __( ‘Dark’, ‘twentyseventeen’ ),
‘myown’ => __( ‘MyOwn’, ‘twentyseventeen’ ),
‘custom’ => __( ‘Custom’, ‘twentyseventeen’ ),
),
‘section’ => ‘colors’,
‘priority’ => 5,
) );
ˋˋ
– change the sanitizer to recognize your color theme (lines 142-155)
ˋ`/**
* Sanitize the colorscheme.
*
* @param string $input Color scheme.
*/
function twentyseventeen_sanitize_colorscheme( $input ) {
$valid = array( ‘light’, ‘dark’, ‘myown’, ‘custom’ );
if ( in_array( $input, $valid, true ) ) {
return $input;
}
return ‘light’;
}ˋˋ
Now I provide the myown.css file and done.
Can this simple change be done in a child theme? I checked various things but inc/ seems to be not replaceable and also re-defining the functions did not work out.
Ideas?
Cheers,
Daniel