Skip to content

Instantly share code, notes, and snippets.

@tedgeving
Created April 25, 2016 20:25
Show Gist options
  • Save tedgeving/eaf8242bc3def4b9bc28b148ed0634e0 to your computer and use it in GitHub Desktop.
Save tedgeving/eaf8242bc3def4b9bc28b148ed0634e0 to your computer and use it in GitHub Desktop.
Set a different Wordpress Admin Color Scheme for each development environment.
<?php
/*
* Set a different Wordpress Admin Color Scheme for each development environment.
* Add this function to the Wordpress functions.php file and make the necessary
* changes to $hosts array().
* Wordpress Default Admin Color themes: default, light, blue, coffee, ectoplasm, midnight, ocean, sunrise
*/
function custom_env_admin_themes(){
//Change the host name and add additional hosts as key/value pairs to this array.
$hosts = array('{http://changeme.dev}'=>'light', '{http://changeme.com}'=>'default');
$site_url = get_site_url();
$admin_theme = 'default';
foreach ($hosts as $key => $value) {
if($key == $site_url){
$admin_theme = $value;
}
}
return $admin_theme;
}
add_filter('get_user_option_admin_color', 'custom_env_admin_themes');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment