Skip to content

Instantly share code, notes, and snippets.

@aaronjorbin
Created December 12, 2013 17:40
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save aaronjorbin/7932093 to your computer and use it in GitHub Desktop.
Save aaronjorbin/7932093 to your computer and use it in GitHub Desktop.
Change the WordPress Admin color scheme every time you login.
<?php
/*
Plugin Name: Color Rotator
Description: Change the color scheme every time you login
Author: Aaron Jorbin
Version: 1.0
Author URI: http://aaron.jorb.in/
License: GPLv2 or later
*/
// Every time a user logs in, change the color scheme
add_action('wp_login', 'jorbin_color_rotate');
function jorbin_color_rotate() {
$new_colors = array( 'fresh', 'light', 'blue', 'midnight', 'sunrise', 'ectoplasm', 'ocean', 'coffee' );
$color_scheme = array_rand( $new_colors , 1);
update_user_meta( get_current_user_id(), 'admin_color', $color_scheme );
}
@aaronjorbin
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment