×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: PHP
Posted by: schos holler
Added: Aug 7, 2017 8:26 AM
Views: 4
Tags: classes wp
  1. // Add role class to body
  2. function add_role_to_body($classes) {
  3.        
  4.         global $current_user;
  5.         $user_role = array_shift($current_user->roles);
  6.        
  7.         $classes .= 'role-'. $user_role;
  8.         return $classes;
  9. }
  10. add_filter('body_class','add_role_to_body');
  11. add_filter('admin_body_class', 'add_role_to_body');