The admin_body_class
filter lets you add classes to the body tag.
This function will add all roles as classes in the form role-$role
, for example role-administrator
, to the body tag:
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' );
Related Posts:
- Adding first / last CSS classes to menus
- WordPress Admin Bar pushed Sticky Footer off the bottom of the page
- Remove admin bar for subscribers
- How to change “Shipping Calculator “field label on Cart Page – woocommerce? [closed]
- wordpress separate registration for different roles
- functions.php not adding css to website?
- Theme Customizer – Dynamic CSS PHP File
- Using PHP in a Stylesheet (possibly a “.htaccess” problem?)
- if file_exists not working with wp_enqueue_style
- Want to create Child theme, but already edited Parent theme css files and some php files
- Using PHP to toggle stylesheet and header image, set in cookie
- wp nav menu: add attributes to menu items [duplicate]
- Put CSS inside a PHP file and include it the right way
- Missing sidebar parameter “fix” – before_content
- How Display Posts on category
- Plugin CSS not enqueing
- How to give new users two specific user role options upon WordPress user registration
- Parent theme CSS overriding child CSS rules
- How to style options page in dashboard?
- Theme Options Page – User Updates Logo
- How to use my style.css file outside of wordpress subdomain?
- Dynamic Stylesheet loads but doesn’t finish
- How to add date to navigation bar
- Can I install/embed WordPress on a ‘single page’?
- Incorrect MIME type for assets with Valet
- custom user role wordpress – grant guest access to edit.php without insert/update/delete
- Customize position of social icons in upme plugin [closed]
- Best way to schedule daily change in CSS parameter
- How do I add a custom css to all posts without affecting homepage css? [closed]
- proper way to add css using functions.php?
- Use PHP in stylesheet to specify a background image based on Category ID
- Automatically set all tags to have a height of 0 if there is no content inside the tag [closed]
- RTL Stylesheet Confusion with WordPress
- Correct way to enqueue page specific CSS file
- Wrapping a Sidebar within
- WordPress wp_add_inline_style unable to give hex colors?
- How to make container class in PHP
- How to create table in wordpress without plugin? [closed]
- PHP in CSS file?
- Add class to DIV depending on page loaded
- Liking a facebook page from wordpress website?
- trouble with page_id & highlighting current page
- Last class on last headline?
- wordpress admin plugin menu custom css
- How to remove sidebar primary widget on Mobile on category page [closed]
- How to Change CSS Colors from Custom Plugin Settings Page
- Can I set up a hover animation in CSS depending on a PHP conditional?
- Issue Enqueueing WordPress style.css
- Link to page with posts of specific type
- Applying CSS on PHP variable [closed]
- How can I call a specific file (via php) by referencing the logged-in username?
- CSS images don’t show up with bloginfo
- how to changes mobile menu toggle breakpoint in WordPress
- Timber right sidebar in WordPress theme
- Applying css in functions.php
- How to Add a cutsom slug to my custom author role
- How to Remove Theme Style CSS inside Custom Plugin?
- Add other class content with reference class value
- oceanwp+woo mobile cart sidebar text
- Adding Custom css file in the wp-uploads directory with custom php functions
- how to create a user rule that can only manage support tickets?
- How to hide a div section when user is logged in, in single product woocommerce
- How do I integrate vanilla Javascript to a wordpress website?
- Drop down question
- Can’t display anything through homepage text editor
- Cannot dequeue Elementor Font Awesome css
- How to find and delete a menu item in php?
- WordPress Slider is not working
- How to display post meta bellow every posts
- How to let mobile navigation menu close when link is clicked?
- Add Shortcode to ::before class
- Fix hover images blink
- Hot to edit WooCOmmerce dashboard?
- Obtain wordpress user role
- Blog Image and Title in Right Sidebar
- Displaying POST content with HTML tags and all
- How to add Open/Close Toggle button into Twenty Fifteen theme for hiding left sidebar?
- Position a repeated article blocks
- Custom Thumbnails [closed]
- Custom user roles doesn’t apply changes
- Include administrator in author list
- Revision History for Entire WordPress Site
- wp add inline style in loop
- WordPress – Image href for home menu nav not working
- Display pages from specific page template
- How do I use CSS or PHP to customize WordPress Form Manager Plugin Table?
- Sidebar doesnt get updated?
- How to NOT override inline css rules
- Add CSS class to PHP Statement
- How to add margin underneath woocommerce total price amount -> productpages
- Load files content [closed]
- Load slideshow.css file only if Slideshow is checked / on
- Predefine Magazine Style Layouts
- It’s not showing full content for posts pages in wordpress “[…]” while customing some changes in the style.css file [closed]
- Add a “Next Post” & “Previous Post” styled button manually to a post
- Parse error: syntax error, unexpected ‘}’ in
- Sorting Problem
- How to lock users account until approvation
- How to create a User Role and give permission to only use Web Stories plugin?
- How to create different templates for woocommerce single-product.php?