treehouse : what would you like to learn today?
Web Design Web Development iOS Development

Apply Custom CSS to Admin Area

Last updated on:

Add to the functions.php file:

add_action('admin_head', 'my_custom_fonts');

function my_custom_fonts() {
  echo '<style>
    body, td, textarea, input, select {
      font-family: "Lucida Grande";
      font-size: 12px;
    } 
  </style>';
}
View Comments

Comments

  1. It must be in the themes functions?

  2. Azhar Kamar
    Permalink to comment#

    Awesome! Just what i need. ;)

  3. Permalink to comment#

    Hi,

    have you tried to test with an external CSS file like :

    add_action('admin_head', 'my_custom_fonts');
    
    function my_custom_fonts() {
      echo '<link rel="stylesheet" href="style.css" type="text/css" media="all" />';
    }

    Maybe it would be more practical.

    Thanks from France (sorry for my poor english) for your good ressources

  4. I agree with NicoGaudin It would be good to know whether this would work with an external stylesheet instead of embedded styles.

  5. Dhafian
    Permalink to comment#

    Yes! I’ll try it.. this is what I need..

  6. Blaine
    Permalink to comment#

    Anyone ever find out if this works with external style sheets?

    • James
      Permalink to comment#

      @Blaine. Use wp_enqueue_style() instead for stylesheets. The method above would work but you’d have less control over where it appeared in the HTML.

  7. Excellent tidbit of code! Solved my problem immediately (I only needed a single line added to my admin CSS and didn’t want to monkey around with core files.)

    A friend wrote a nice blog article on customizing the editor if need more advanced control: How to Make the WordPress Editor Look Like the Web Site

Leave a Comment

Use markdown or basic HTML and be nice.