• Skip to main content

locally.co.uk domain for sale

private domain sale

Coding Tips

WordPress 3.8 Admin Colour Selection

15th December 2013 by Alan 2 Comments

WordPress 3.8 Colour Schemes

WordPress 3.8 brings a new styled administration backend. Making it responsive and with a selection of 6 colour schemes. The previous version only had two colors, blue or grey.

Users can easily select or change which colour scheme they want by going to their user profile and making the change.

Regular WordPress users can stop reading here, however if you are a WordPress developer looking for a way to set the default scheme to match your own branding or any other reason, please read on.

The default color scheme is black, grey, blue, but for our sites, we wanted our default scheme for new users to be ‘Midnight’, black, grey, blue red so we could differentiate the full back end from the colour scheme we use for the Easy Blogging Plugin (from WPMU DEV) that we provide on our sites.

To do this you need to set the user meta option when a new user is created.

Add the following bit of code to your functions.php (changing the scheme name as required)

[code]

add_action( ‘user_register’, function($userid) {
update_user_option( $userid, ‘admin_color’, ‘midnight’);
});

[/code]

If you are doing this on a WordPress multi-site, there is an additional parameter required at the end of  the call to update_user_option  and you probably want to create a mini plugin or add it to other multi site code you already have in your own ‘plugin’

e.g.

[code]

<?php
/*
Plugin Name: do-special-stuff

Plugin URI: https://multisite.locally.uk
Description: Does extra stuff for my multisite
Version: 0.1
Author: Locally
Author URI: https://multisite.locally.uk
*/

/* —-   set default admin colour scheme for new users— */

add_action( ‘user_register’, function($userid) {
update_user_option( $userid, ‘admin_color’, ‘midnight’, true );
});

/* — end  admin colours — *

?>

[/code]

Filed Under: Technical & Design Tagged With: Admin Colour Scheme, Coding Tips, WordPress 3.8

locally.co.uk is owned by Fullworks Digital Ltd which is a company registered in England and Wales, company number: 07720957 Copyright © 2022 · Fullworks Digital Ltd

  • Privacy and Cookies
  • Legals
  • Articles