Update : the Customiz’it button has been removed since v3.1.12 of the theme
Howdy developer!
Even if I have tried to style them as good as I could :-?, some of you might be bothered by the help and customiz’it buttons in the top admin bar. Or may be you just don’t want your client to see them?
Anyway, here’s a quick snippet to get rid of those.
Where to copy/paste this code? Answer : in your functions.php file (of a Customizr child theme). The best way to customize a theme in WordPress is to create a child theme. Everything you need to know about child theme creation in Customizr here
add_action ('init' , 'remove_admin_bar_buttons'); function remove_admin_bar_buttons() { remove_action ( 'wp_before_admin_bar_render', array( TC_admin_init::$instance , 'tc_add_help_button' )); }
Following @hugh comment, here’s an update of the callback function to remove those buttons for non-admin users only :
function remove_admin_bar_buttons() { global $current_user; get_currentuserinfo(); if ( in_array( 'administrator', $current_user -> roles ) ) return; remove_action ( 'wp_before_admin_bar_render', array( TC_admin_init::$instance , 'tc_add_help_button' )); }
And they are gone! Hope this helps you guys!
10 thoughts on “Removing the Help and Customiz’it admin bar buttons”
Hi Guys, sorry to post here, I am not getting this code to work. It gives a fatal error on TC-customize. Can you help.
By the way, a great theme.
Regards
Marius
Hi Marius, the Customiz’it button has been removed since v3.1.12 of the theme.
The snippet has just been updated.
Thanks
Is there a way to only apply this filter to roles less than “admin”/”god”. Not letting the client see them is good. But I do like them as the dev.
Hi Hugh, I have just updated the snippet with this feature. Thanks for the idea!
Hi there! That is me again!
Now just repeatig my previous request to you Nicolas!
Teach me how to use functions.php and apply to my Customizr Theme because I have niticed that , with php, I wil be able to perform many interesting changes in my Wordpress.
Thanks again,
Samuel
Hi Samuel, again, you might want to learn the basics from the WordPress codex before diving more into theme customizations : http://codex.wordpress.org/Functions_File_Explained
Have fun learning WordPress, cheers
I pasted the above code, and it made no changes. I’m already using a child theme to add a function in functions.php, and that other function is definitely working. I pasted this code into the same child functions.php and nothing has changed. Any thoughts?
Hi James and thanks for this feedback. The code actually needed a correction because it was only working in admin but not for the frontend.
I replaced this line :
By this :
And now they are gone everywhere.
Thanks for pointing this out and enjoy the theme.
Thanks Nicolas. The buttons were handy and I know you thought you were doing the right thing. But I have now removed them because my admin bar had so many buttons from other plugins that it was folding onto two lines. I only wish other developers provided similar code.
FYI I discovered that the presence of the admin bar caused the slider to work differently. It seemed to be doing vertical auto cropping. When I removed the admin bar I found that the auto cropping stopped. I tested it using images with grid lines to see the exact effect. I tried various sizes of images to see if that made any difference but it didn’t. The cause must have been the admin bar.
Thanks for this feedback Denis!