Support » Developing with WordPress » Customizing admin CSS

  • I want to add some CSS code to the admin theme.
    If the color scheme is FRESH then i want to add some style. If not i want to use another CSS file.

    When doing a print_r($layout); it says classic ( i use that) but it adds the dark.css file.
    What am i doing wrong?

    function css_admin_head() {
    	global $user_ID;
    	$layout = get_user_meta($user_ID, 'admin_color', true);
    		if ($layout = 'fresh') {
    			echo '<link rel="stylesheet" type="text/css" href="' .plugins_url('dark.css', __FILE__). '">';
    		else {
    			echo '<link rel="stylesheet" type="text/css" href="' .plugins_url('light.css', __FILE__). '">';
    add_action('admin_head', 'css_admin_head');

Viewing 6 replies - 1 through 6 (of 6 total)
  • Moderator Ipstenu (Mika Epstein)


    🏳️‍🌈 Halfelf Rogue & Plugin Review Team Rep

    Moved to WP-Advanced (this isn’t a Multisite thing, it’s general WP)

    When doing a print_r($layout); it says classic ( i use that)

    What’s the full output?

    This is the full output:
    <link rel="stylesheet" type="text/css" href="">

    And the print_r($layout); prints “classic” thats it.

    and if i enable the fresh layout on my user profile it prints “fresh”. So that works.

    i think my “error” is: if ($layout = ‘fresh’)
    But i dont know what to type here.

    your “error” is: if ($layout = ‘fresh’)

    if ($layout == 'fresh')

    PHP and JavaScript behave similarly:

    Thanks! That worked!

    Such an easy fix! Just a = too little!

    Okay I need helpppppppppp! I am trying to change the color of my menu fonts. I have looked through sop many codex pages my eyes are blurry. My CSS page is different to all the ones I see online that they are changing in the codex area. I have the these Portfolio Press theme.

    I want to be able to change the font size and color of the menu and body.

    Please help.

    Thanks signed frustrated.

    @steadyone – your question is not the same as this one – and this is not the right forum for it either. If you need help with Portfolio Press theme, please start a new thread here:

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Customizing admin CSS’ is closed to new replies.