cboy
cboy

Reputation: 179

How can I edit styles in the admin section of a Wordpress site (eg. changing the color of the admin toolbar)

Will someone please show me how to change the color of one dashicon on the wordpress admin toolbar? When I change the color in browser inspector, the color changes, but when I add it to my style sheet, it does not work no matter how specific I make it.

#adminmenu .current div.wp-menu-image::before, #adminmenu .wp-has-current-submenu div.wp-menu-image::before, #adminmenu a.current:hover             div.wp-menu-image::before, #adminmenu a.wp-has-current-submenu:hover div.wp-menu-image::before, #adminmenu li.wp-has-current-submenu a:focus        div.wp-menu-image::before, #adminmenu li.wp-has-current-submenu.opensub div.wp-menu-image::before, #adminmenu li.wp-has-current-submenu:hover       div.wp-menu-image::before {
color: #e74b4b;
} 

Upvotes: 1

Views: 931

Answers (2)

cboy
cboy

Reputation: 179

Thank you all for your replies which led me to the correct answer that made it work for me. You would use this if you are using a child theme.

function my_admin_theme_style() {
    wp_enqueue_style('my-admin-style', get_stylesheet_directory_uri() . '/admin_style.css');
}
add_action('admin_enqueue_scripts', 'my_admin_theme_style');

Upvotes: 0

vlasits
vlasits

Reputation: 2235

Most likely you are putting your css into the wrong css file. The admin section doesn't load the standard 'style.css' file.

You will want to add your admin styles to a separate file like my_admin_styles.css or something within your theme and then include it with the admin_enqueue_scripts() function. Or, if you don't have access to editing the functions.php file, you may need use a plugin as the commenter below mentions.

Upvotes: 1

Related Questions