Created
February 7, 2017 08:59
-
-
Save dededey/8fffd22e118076c8a1044a69171872c7 to your computer and use it in GitHub Desktop.
// Add role class to body
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add role class to body | |
function add_role_to_body($classes) { | |
global $current_user; | |
$user_role = array_shift($current_user->roles); | |
$classes[] .= 'role-'. $user_role; | |
return $classes; | |
} | |
add_filter('body_class','add_role_to_body'); | |
add_filter('admin_body_class', 'add_role_to_body'); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment