This topic has 6 replies, 3 voices, and was last updated 7 years by Radu.

  • Author
  • #145968
     Hanifa
    Participant

    Hi there,

    I would like you help to resolve a issue I didn’t have before.

    Because of others issues I had, I had to uninstall and re-install the Theme KLEO and this with other things resolve a issue I had before.

    But know I’m having some problems with the Admin Bar. Because if I choose in the Theme Misc, to hide, I also wont see it, and so I have to have a link directly to the back-end to go to wp-admin. And if I activated every users see the bar.

    What I want is only admin and editores (moderatores) to be able to see the admin bar, and want to hide it for all the others members.

    Can you help with the Theme Misc Admin Bar to do so? Maybe right some function and tell me where to put it.

    I also leave here the credentials for login in my website if you need it.

     

     

     

    #146105
     Radu
    Moderator

    Hi

    Set hide admin bar from admin -> theme options -> misc then add this code to child theme ( wp-content/themes/kleo-child/functions.php )

    COPY CODE
    
    add_action('after_setup_theme', 'add_admin_bar_for_admins');
     
    function add_admin_bar_for_admins() {
        if (current_user_can('Administrator') OR current_user_can('Editor') ) {
            show_admin_bar(true);
        }
    }
    

    Note : Child theme needs to be installed and activated

    Cheers
    R.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #158897
     MCDeditora
    Participant

    hi there!
    I have the same issue and tried this but it didn’t work.
    Any other idea?
    Thanks in advance!

    #159060
     Radu
    Moderator

    Hi,


    @MCDeditora
    , Make sure to have child theme installed and activated.

    Cheers
    R.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #159334
     MCDeditora
    Participant
    This reply has been set as private.
    #159336
     Hanifa
    Participant

    Hi there,
    I’m just a user of KLEO Theme,
    But the only way you going to resolve that is by using this plugin:
    Remove Dashboard Access
    If you use this plugin, it will remove the dashboard access to all your users, include you.
    For me to have acess create a bookmark in my browser in the link to gain access to WP back office.
    This link it will look like this: sevethqueen.com/wp-admin/

    #159484
     Radu
    Moderator

    Hi,

    This snippet it works, I’ve tested

    For me (Admin) it’s shown but for subscriber it’s hidden

    COPY CODE
    
    add_action('init', 'add_admin_bar_for_admins');
    
    function add_admin_bar_for_admins() {
        if (current_user_can('Administrator') OR current_user_can('Editor') ) {
            show_admin_bar(true);
        }else {
            show_admin_bar(false);
        }
    }
    

    Cheers
    R.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
Viewing 7 posts - 1 through 7 (of 7 total)

The forum ‘Bugs & Issues’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?