• Best Drag & Drop Website Builder
  • Build Any Type of Website
  • Unlimited design flexibility
  • Drag & Drop Builder

Enhanced Body Class

by Noah Stewart

0 Ratings

Active Installations

Fewer than 10

Last Update

1 year

Quality

D

Plugin Description

Description
WordPress plugin to add user-related classes to the body tag. This can be enabled on the frontend and backend of the site.
The css classes allow you to easily customize styling by role or a specific user.
Features
Toggle display on frontend and admin pages
Toggle classes for role, user name and user id
Template hinting to load custom theme css files for frontend and admin
Stylesheets
Add to theme folder (optional): enhanced-body-class-frontend.css
Add to theme folder (optional): enhanced-body-class-admin.css
Scripts
Add to theme folder (optional): enhanced-body-class-frontend.js
Add to theme folder (optional): enhanced-body-class-admin.js
Styles
.user-role-{rolename} ex: .user-role-author
.user-name-{username} ex: .user-name-bobdobbs
.user-id-{ID} ex: .user-id-1
Usage
After activating the class on the body tag, it will be up to you to use css or javascript to customize the display.
Activate ‘User Role’ on ‘Admin Pages’ in plugin settings
Observe classes on BODY tag by viewing the webpage source. You may need to refresh the page to see the updated class.
Navigate to current theme and create file
enhanced-body-class-admin.css
Edit
enhanced-body-class-admin.css
and add the following:
body.user-role-administrator { background-color: cyan; }
Refresh the page. You should now see a cyan background. You can now update the css to change the display of specific
page elements.
Real Usage
This plugin was developed to hide certain elements in a popular photo gallery from users with a specific role.
Create the theme file
enhanced-body-class-admin.css
`
body.user-role-contributor #updategallery #gallerydiv { display: none; }
`
Create the theme file
enhanced-body-class-admin.js
`
jQuery(document).ready(function($) {
$(‘body.user-role-contributor select#bulkaction option[value=”copy_to”]’).attr(‘disabled’, ‘disabled’);
});
`
About This Plugin
This plugin was created by Noah J. Stewart in response to a specific problem. In January 2019,
Noah Stewart was contacted by his father Jim Stewart regarding a WordPress photo gallery plugin
that his astronomy club was using. They were having trouble customizing a few of the role-based
options in a popular gallery plugin. Like any good graphic artist, Jim was trying to improve
the interface for the site users. The simplest approach to the problem was to use css to
selectively hide certain elements, ie. invisible content users with the author role that
should be visible to users with the administrator role.

Similar Plugins

  • Report Bug
The content on this website originates from various sources. All rights to the original content remain with the respective author. If you believe that your copyrights have been infringed by the use of content on this website, please contact us at info@plugin-guru.com. We will remove the content in question immediately.

This is the heading

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.

Collections

Create your first Collection

To create a collection, simply click on the symbol on the desired plugin.

You can see this symbol when you move the mouse over the plugin. 

Current Level

Plugin Magican

You have reached 0 views on your collections and are currently Plugin Magican. You magically help people find the right plugins and are a great asset to the community

0 of 500 views reached