• Skip to primary navigation
  • Skip to main content

joshsushi

  • About
  • Blog
    • Freelancing
    • Marketing
    • WordPress
    • Uncategorized
  • Tools
  • Contact

Apply CSS to WordPress admin

Do you want to hide something in the WordPress admin? Or change the color by CSS?

Here’s how to do it.

Add the following code to functions.php of your theme.

function my_custom_admin() {
  echo '<style>
    tbody#the-list tr.status-draft th.check-column {
	background-color:lightpink; 
	border-top:1px solid #f1f1f1; 
	}
    } 
  </style>';
}

add_action('admin_head', 'my_custom_admin');

Replace the content between <style></style> with your code.

I wanted to change the background color of a column on the Posts list page, so that I can easily see which post is still in the draft state.

The snippet I wrote above makes the th column background color light pink, if the post is in the draft state, like this.

If I publish the post, then the light pink background color will go away.

How About the Theme’s Stylesheet?

Nope, editing the theme’s stylesheet won’t change the looks inside the admin area.

In the above snippet, you tell WordPress to hook your changes to the admin area with add_action( admin_head, your_thing_here );

Recommended Plugins

You can also use Admin Menu Editor plugin for cosmetic changes like reordering the menu items.

User Role Editor lets you control and assign privileges for each user role.

This is a nifty way to change the looks inside the WordPress admin area.

This is especially useful if you’re developing a website for a client and want to make things a little easier on the eye for the client.

Updated 2021-01-08 Post Under: Wordpress

Other Posts

  • Why SendFox? Best Entry-level Email Service Provider
  • Best Website Hosting for Beginners, Freelancers, and Agencies
  • How to Change the Font Inside Gutenberg Editor
  • SiteGround Hosting Limitations
  • Replace URL in the PhpMyAdmin Database Using MySQL Scripts
  • Get SSL with a Site on Hostinger for Free
  • Get Unstuck Writing Your Blog Post (My 5-Step Writing Process)
  • Optimize WordPress Images to Make Your Site Faster
  • Change Your WordPress Username in PhpMyAdmin
  • How to Hire Freelance Composer, Arranger, Audio Engineer or Musician

Copyright © 2023 · joshsushi.com