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:
- How to hide a div section when user is logged in, in single product woocommerce
- Hide payment method based on user role AND minimum cart value
- How do I integrate vanilla Javascript to a wordpress website?
- I have a background-image in css file but don’t show in site.how to fix this prblm. i sent screenshot. thx
- Help me I cannot link my font-awesome to my WordPress Theme. I have my font-awesome folder already in my project
- Warning: Use of undefined constant all – assumed ‘all’ (this will throw an Error in a future version of PHP) in C:\Users\…….. on line 6
- Drop down question
- Trying to generate a CSS file in wordpress uploads folder
- WP Website is shown in HTML
- Can’t display anything through homepage text editor
- Cannot dequeue Elementor Font Awesome css
- How to find and delete a menu item in php?
- Edit a function to take different actions based on user role
- How to print all the inline styles in the WP_Styles instance together with their keys?
- I cannot find the wordpress.scss file that my live site is pulling from
- The style.php file inside theme-engine folder has other content on FTP
- Google CSE Malfunctions via Chrome/Safari on Mobile When Clicking on Either Search Icon/Menu Icon. How to Make Google CSE Default Theme Search
- I have a lot of JavaScript erorrs after SSL someone can help me?
- WordPress Slider is not working
- I got big white screen when i attach main style sheet of Html in functions.php
- register dependency css and js inside a plugin class
- Hide author from search results meta, still display date and categories
- How to display post meta bellow every posts
- How to locate parent theme functions and add functions to my wordpress child theme?
- How to let mobile navigation menu close when link is clicked?
- how to add functions to my function.php using a child theme?
- Used a code to revoke some dashboard menus for my contributors but for some reason it’s revoked me access to the editor [closed]
- Add my footer menu to the header
- Replace header with large image on home page only, using Genesis child theme
- Add a default style if no Featured image is selected
- Add Shortcode to ::before class
- Make a full-width wordpress page
- How to give custom roles the capability to edit one Menu instead of every Menu
- Site title not showing. Please help me
- Fix hover images blink
- Bring Font Awesome icons inside menu A tags
- PHP/CSS: Shortcode won’t display correctly, and only displays in the head (before content)
- Styling a specific post after hovering over it
- Hot to edit WooCOmmerce dashboard?
- Add another role to a user when they click a button?
- Obtain wordpress user role
- Using Sprit-sheet on WordPress categories
- Blog Image and Title in Right Sidebar
- Trying to add get_the_title hook to this line
- Add class for the_post_thumbnail_caption()
- How to properly create multiple conditions to redirect users roles to different pages
- custom field – changing an element or background of id div – different versions not working
- Echo Option Value Based On WordPress User Role
- Target a specific container to style on WordPress storefront theme
- How to display post_content from database in different on template page?
- How to include different html tags in the header for different pages?
- Displaying POST content with HTML tags and all
- remove blank space where sidebar was
- CSS loading as empty file in Custom Theme
- How to add Open/Close Toggle button into Twenty Fifteen theme for hiding left sidebar?
- user update profile for custom code
- Display specific main Sub Nav on Woocommerce product pages
- Position a repeated article blocks
- Clone the “proceed to cart” button and place it above checkout on the cart page, but only appear display size is 320px
- Role exception for a settings sub menu
- How limit the width of a fixed menu-bar on scroll?
- Highlight Single Page Ancestor
- Custom Thumbnails [closed]
- Font-Family does not looks like how it should be [closed]
- Custom Theme, Editor won’t wrap text (i.e. change width)
- Where to find the html for WordPress site? [closed]
- Click to expand menu
- Relative post date in recent posts list
- Allow BBPress participant role to trash topics
- How to add style in functions.php depending on conditions?
- How to remove image on single product and get product to span page?
- Widget edit and add in any page
- widget: input the px value from user and use it as inline style in widget function
- Custom user roles doesn’t apply changes
- Modify arguments for parent theme’s `wp_register_style` via child theme
- Styling admin page rows in order of importance (checkboxes)
- Include administrator in author list
- Hide button based on PHP result
- Why isn’t my link attribute getting my css?
- How to connect database table to each registered wordpress user.
- How to have Function of a plugin using global vars into a shortcode?
- How to save the output of php variables used in inline css code to the main style.css?
- Revision History for Entire WordPress Site
- Show contact 7 form in popup
- wp add inline style in loop
- Child theme not working properly
- WordPress – Image href for home menu nav not working
- How Can I Center the Logo in the Navigation Menu? [closed]
- Get author meta of all writers
- featured post as div background
- Combining fancybox with multiple thumbnail plugin
- Display pages from specific page template
- Trying to customize wordpress drop down categories
- Show Nav Link To Users Signed In
- WP_Nav Highlight Parent Issue
- Cant get theme to change footer color through theme customizer
- Hide ID for WordPress User Role Subscriber
- Is it possible to remove the “Shop” title from the WooCommerce catalogue? [closed]
- Removing website URL in comments causes misalignment of submit button and tickbox
- How to add global CSS to all webpages without installing any plugin?