0

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;
}
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;
}
  • I did both of those, independently and together. When I rename and add a higher priority, it replaces the default scheme with My Custom Colors, and that's at the top of the drop down list. But the new colors aren't applied. Without the ['default'] or priority, no other changes, my color scheme is at the end of the list, and if selected through the customizer, functions properly. – whakawaehere Nov 6 '18 at 19:59
  • when you had the array as custom, did it show up on the backend as a color scheme choice? – rudtek Nov 6 '18 at 20:00
  • Yes - it shows up at the bottom of the list, and works as expected. – whakawaehere Nov 6 '18 at 20:05
  • i just added this to the functions.php in twentyfifteen and loaded up the theme. It overwrote "default" with "my new default color" and was selected. All colors were changed. – rudtek Nov 6 '18 at 21:59
  • Very strange. I’ll have to spin up a clone and see what’s up. Thanks for digging into it! – whakawaehere Nov 6 '18 at 22:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.