"How to Build a WordPress Plugin" was retired on July 6, 2019.

Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress Customizing the WordPress Admin Area Admin Color Schemes Customizing Admin Color Schemes from Scratch

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,253 Points

Treehouse Palette doesn't show up in the admin area.

Hello all. :)

This is a tricky one.

The Treehouse palette isn't showing up when I add the code to the Admin panel.

I'm pretty sure my code and file structure is correct.

I've correctly... I think linked up the child theme. My theme is called wpthemecustomizer and the child is wpthemecustomizer-child.

child-theme (d)
    functions.php
    style.css
    admin-colors (d)
            treehouse (d) - a folder for a new palette of admin colours 
               colors.css

And here's my code in my child theme functions.php file.

function _wpt_admin_color_schemes() {

      $theme_directory = get_stylesheet_directory_uri();

      wp_admin_css_color(

         'treehouse', __('Treehouse'),
         //use concatenation to build the path to the CSS file that adds controlls the view of the palette. 
          $theme_directory . '/admin-colors/treehouse/colors.css',     
         //contains an array og hexadecimal codes to display on Admin area as list of colours
         array('#384047', '#5bc67b', '#838cc7','#ffffff')
      );

}

add_action('admin_init', 'wpt_admin_color_schemes');

Help! :)

2 Answers

Lee Adamson
Lee Adamson
9,347 Points

Hi

I experienced the same issue, after a bit of googling I found this answer which works

function new_color_scheme() {

wp_admin_css_color(
    'new', __( 'NEW' ),
    get_stylesheet_directory_uri() . '/admin-colors/new/colors.css',
    array( '#0051ba', '#f9d616', '#F50057', '#FF4081' )
    );
}

add_action( 'admin_init', 'new_color_scheme');
Bradley Maravalli
Bradley Maravalli
8,927 Points

Had the same issue. Make sure you have the Twenty Fourteen Child Theme activated.