custom css for admin only

I need custom css for andmin. Si if user is not log in or is anything else but admin there is one css, and for andmin only different css.

I tried this cone in functions.php:

function wpa66834_role_admin_body_class( $classes ) {
global $current_user;
foreach( $current_user->roles as $role )
$classes .= ‘ role-‘ . $role;
return trim( $classes );
}
add_filter( ‘admin_body_class’, ‘wpa66834_role_admin_body_class’ );

and in custom css field:

#targetElement {
display: none;
}
.role-administrator #targetElement {
display: visible;
}

But it doesn’t work.

Read more here:: custom css for admin only

Leave a Reply

Your email address will not be published. Required fields are marked *