functions - Change default color scheme in twentyfifteen child theme?

admin2025-06-06  1

I read the previous ask about this. And tried renaming my scheme to "default" and it didn't work.

I am implementing the child theme on 50+ blogs on a network and I would like to just click "Activate" rather than also choose the color scheme. Any help would be great. This is what I have in my child theme's functions.php file.

add_filter('twentyfifteen_color_schemes', 'my_custom_color_schemes');
function my_custom_color_schemes( $schemes ) {
    $schemes['custom'] = array(
        'label'  => __( 'My Custom Colors', 'twentyfifteen' ),
        'colors' => array(
            '#f8f7f4',
            '#002244',
            '#f8f7f4',
            '#585552',
            '#ffffff',
            '#f8f7f4',
        ),
    );
    return $schemes;
}

I read the previous ask about this. And tried renaming my scheme to "default" and it didn't work.

I am implementing the child theme on 50+ blogs on a network and I would like to just click "Activate" rather than also choose the color scheme. Any help would be great. This is what I have in my child theme's functions.php file.

add_filter('twentyfifteen_color_schemes', 'my_custom_color_schemes');
function my_custom_color_schemes( $schemes ) {
    $schemes['custom'] = array(
        'label'  => __( 'My Custom Colors', 'twentyfifteen' ),
        'colors' => array(
            '#f8f7f4',
            '#002244',
            '#f8f7f4',
            '#585552',
            '#ffffff',
            '#f8f7f4',
        ),
    );
    return $schemes;
}
Share Improve this question asked Nov 6, 2018 at 19:30 whakawaeherewhakawaehere 7910 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

Adding 'default' should work. Did you try calling the colors and seeing if your filter is working?

If it's not you could try adding a higher priority to your filter

add_filter( 'twentyfifteen_color_schemes', 'my_custom_color_schemes', 99 );
function my_custom_color_schemes( $schemes ) {
    $schemes['default'] = array(
        'label'  => __( 'my new default color', 'twentyfifteen' ),
        'colors' => array(
            '#f8f7f4',
            '#002244',
            '#f8f7f4',
            '#585552',
            '#ffffff',
            '#f8f7f4',
        ),
    );
    return $schemes;
}
转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1749201795a317216.html

最新回复(0)