[php]
/***********************************************************************
* ADD USER ROLES TO BODY CSS CLASSES
*
***********************************************************************
*/
function get_user_roles() {
global $current_user;
$user_roles = NULL;
$user_roles_array = $current_user->roles;
foreach ($user_roles_array as $user_role) {
if (!empty($user_role || $user_role != ‚ ‚)) {
$user_roles .= $user_role . ‚ ‚;
}
}
return $user_roles;
}
if ( is_user_logged_in() ) {
add_filter(‚body_class‘,’my_class_names‘);
}
function my_class_names($classes) {
$classes[] = get_user_roles();
return $classes;
}
[/php]
Related Articles
- Fix Elementor fixed Background sizing
- Cronjob Überlappung verhindern – flock()
- WordPress Update Hinweise deaktivieren
- WP Download Manager "attached file is missing/deleted" Fehler
- WordPress Staging: Uploads Ordner von Production Seite einlesen (per htaccess)
- WC Attribute Komma durch Linebreak ersetzen
- User Meta field nach User Role summieren
- SASS starten
- Sublime Text für WordPress einstellen