Title: CSS for userroles
Last modified: July 15, 2022

---

# CSS for userroles

 *  Resolved [hotice83](https://wordpress.org/support/users/hotice83/)
 * (@hotice83)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/css-for-userroles/)
 * Hi
 * I have 2 issues
 * 1. I want to collapse and hide/remove the left sidebar completely – so my content
   uses this space.
 * 2. i want to do this for the specific users or user roles.
 * I see there is the custom CSS section, but this applies to all user roles

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Plugin Support [Imran – WPMU DEV Support](https://wordpress.org/support/users/wpmudev-support9/)
 * (@wpmudev-support9)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/css-for-userroles/#post-15829047)
 * Hello [@hotice83](https://wordpress.org/support/users/hotice83/) !
 * I trust you’re doing great!
 * > 1. I want to collapse and hide/remove the left sidebar completely – so my content
   > uses this space.
 * If I understand correctly, that’s the wp-admin menu you’re referring to. There’s
   an option to collapse it at the bottom, but you can also try this CSS in Branda
   >> Admin Area >> Custom CSS:
 *     ```
       #adminmenumain { display: none !important; }
       #wpcontent { margin-left: 0px !important; }
       ```
   
 * For the CSS per role, you can try this snippet: [https://lakewood.media/add-user-role-id-body-class-wordpress/](https://lakewood.media/add-user-role-id-body-class-wordpress/)
   and it will add a class specific to a role to the body element. Then you can 
   target that specific role in your CSS, for example for Editors:
 * `body.editor #some-selector { display: none !important; }`
 * Warm regards,
    Pawel
 *  Thread Starter [hotice83](https://wordpress.org/support/users/hotice83/)
 * (@hotice83)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/css-for-userroles/#post-15833627)
 * Thanks for this
 * I tried doing this with the CSS you had given along with snippet for my woocomercce“
   shop manager” role.
 * However, it seems when I do that, it removes all the other stuff I have set with
   Branda e.g menu items for that user role that i removed all come back
 *  [Kris – WPMU DEV Support](https://wordpress.org/support/users/wpmudevsupport13/)
 * (@wpmudevsupport13)
 * [3 years, 10 months ago](https://wordpress.org/support/topic/css-for-userroles/#post-15838344)
 * Hi [@hotice83](https://wordpress.org/support/users/hotice83/)
 * Could you let us know what kind of CSS code you have added and does it have the
   correct selectors? If this is done correctly only those selectors should be hidden.
 * Also there is possibility you use selectors which are used in other sections.
   Then this could happen.
 * bad xxample:
    `body.editor .css_class_used_in_many_places {}`
 * good example:
    `body.editor #some_container_like_#content .css_class_used_in_many_places{}`
 * With that, it should only affect those selectors in some content.
 * Kind Regards,
    Kris
 *  Thread Starter [hotice83](https://wordpress.org/support/users/hotice83/)
 * (@hotice83)
 * [3 years, 10 months ago](https://wordpress.org/support/topic/css-for-userroles/#post-15838450)
 * i want to use this
 * #adminmenumain { display: none !important; }
    #wpcontent { margin-left: 0px !
   important; }
 * for the user role “shop manager”
 * Can you please give me the exact css it should be
 * Sorry i’m not great at coding which is why i use branda in the first place
 *  Plugin Support [Laura – WPMU DEV Support](https://wordpress.org/support/users/wpmudev-support8/)
 * (@wpmudev-support8)
 * [3 years, 10 months ago](https://wordpress.org/support/topic/css-for-userroles/#post-15843073)
 * Hi [@hotice83](https://wordpress.org/support/users/hotice83/)
 * Setting “display: none” for #adminmenumain will fully hide entire admin menu (
   entire left menu column in wp-admin) area. If this is exactly what you want to
   do then let’s take a step back.
 * 1. remove all the code/undo everything that was discussed here so far
 * 2. create empty file with a .php extension (e.g. “admin-userrole-css.php” )
 * 3. copy and paste this code into it (using plain text editor)
 *     ```
       <?php 
   
       function wpmu_admin_side_role_based_style() {
   
       	if ( current_user_can( 'shop_manager' ) ) {
       	?>
   
       	<style>
       		#adminmenumain { display: none !important; }
       		#wpcontent { margin-left: 0px !important; }
       	</style>
   
       	<?php 
       	}
       }
   
       add_action('admin_footer', 'wpmu_admin_side_role_based_style');
       ```
   
 * 4. save the file
 * 5. use your favorite FTP client (like FileZilla or similar) or cPanel’s “File
   Manager” and upload that file to the “/wp-content/mu-plugins” folder of your 
   site’s WP installation
 * It should work out of the box (I tested it).
 * Note please: I understand that this is slightly different and includes PHP but
   it’s very simple code and much simple solution than using multiple plugins and
   codes.
 * Kind regards,
    Adam
 *  Thread Starter [hotice83](https://wordpress.org/support/users/hotice83/)
 * (@hotice83)
 * [3 years, 10 months ago](https://wordpress.org/support/topic/css-for-userroles/#post-15843153)
 * Amazing!, thanks so much

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘CSS for userroles’ is closed to new replies.

 * ![](https://ps.w.org/branda-white-labeling/assets/icon-256x256.gif?rev=3407049)
 * [Branda – White Label & Branding, Free Login Page Customizer](https://wordpress.org/plugins/branda-white-labeling/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/branda-white-labeling/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/branda-white-labeling/)
 * [Active Topics](https://wordpress.org/support/plugin/branda-white-labeling/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/branda-white-labeling/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/branda-white-labeling/reviews/)

 * 6 replies
 * 4 participants
 * Last reply from: [hotice83](https://wordpress.org/support/users/hotice83/)
 * Last activity: [3 years, 10 months ago](https://wordpress.org/support/topic/css-for-userroles/#post-15843153)
 * Status: resolved