Custom Admin CSS in WordPress

Glenn Glenn's Blog 1 Comment

Here is a snippet for you to add to your WordPress site to customise the CSS of the WordPress Admin Area. This is useful if you want to hide elements, change their colours etc – basically you can add any styles you want.

Add this to your site’s functions.php file:-

[php]
/*—————————————————————-
* CUSTOMISE ADMIN AREA
*—————————————————————*/

function customAdmin() {
$url = get_settings(‘siteurl’);
$url = $url . ‘/wp-content/themes/your-theme-name/styles/admin.css’;
echo ‘<!– custom admin css –>

<!– /end custom adming css –>’;
}
add_action(‘admin_head’, ‘customAdmin’);

[/php]

Replace ‘your-theme-name’ with your actual theme name and now simply create a ‘styles’ directory in your theme if you haven’t already got one and then add a css file called admin.css. All you now have to do is add your CSS styles in the admin.css file as norma – So Easy!

What if I’m using WordPress Multisite?

We’ve got you covered. Just change ‘site url’ on line 06 to ‘network_home_url‘.

About the Author
Custom Admin CSS in WordPress Custom Admin CSS in WordPress 0da77002febbfe28d15144a57bbcc2c9 s 180 d mm r g

Glenn

A highly experienced WordPress Web Developer, Front-end and Back-end Developer & New Media Specialist with extensive knowledge of a wide spectrum of technologies in the Development and Creative Industries built up over a number of years.

Comments 1

Leave a Reply

Your email address will not be published. Required fields are marked *