0

I have a login top bar I use for general users on the website front end and the admin like to use the wordpress admin bar. I am trying to find a way of hiding the login top bar for admin so they just use the wordpress admin bar (this is only enabled for admin). I would also like to change the CSS of the main container if admin is logged in.

I have been looking for code on Git hub and the web but can't find anything that has worked for me. Does anyone know if this is even possible?

2 Answers 2

1

You could use something like this if you have jquery included in your page:

<?php
if ( is_super_admin() ) {
?>
    <script type="text/javascript">
    $( document ).ready(function() {    
        $("#IDofDivHoldingUserTopBar").css("display", "none"); // ID of user top bar
// ............................. OR     
        $(".ClassofDivHoldingUserTopBar").css("display", "none"); // class of user top bar
    });
    </script>
<?php
}
?>
0
1

You can try with current_user_can() function.

Step:

if( ! current_user_can('manage_sites')){
   // SHOW THE LOPGIN TOP BAR
}
1
  • This also works so I upvoted. Commented Aug 13, 2014 at 12:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.