Disable admin bar

Posted in: Newspaper
Post count: 13

Hi, i’m trying to disable the admin bar for logged in users apart for the administration role.
I use this code in the functions.php file but i doesnt work at all.
// show admin bar only for admins
if (!current_user_can('manage_options')) {
add_filter('show_admin_bar', '__return_false');
}
// show admin bar only for admins and editors
if (!current_user_can('edit_posts')) {
add_filter('show_admin_bar', '__return_false');
}

Can you tell me how to do it?
Thanks in advance

Post count: 20688

Hi,

Something like this will remove the admin bar for all users except admins
https://www.wpbeginner.com/wp-tutorials/how-to-disable-wordpress-admin-bar-for-all-users-except-administrators/
You could give it a try, it should work fine.

Thanks

Post count: 13

Hi Simion, unfortunately it doesn’t work. The code in the tutorial is much similar to the one i used before, anyway i have put in the functions.php file but nothing change! I still see the admin bar for non-admin users.
If you want, i can give you user/pwd for admin role so you can check out by yourself.
Thanks

Post count: 20688

I also tested that code. Here I logged with an author user role, admin bar enabled in WordPress settings and showing
https://www.screencast.com/t/22f1euntyc0b
https://www.screencast.com/t/RCtsTPZ0Trd

I then entered that code in the theme functions file
https://www.screencast.com/t/LxwDzWDx
After forcing the page to refresh (sometimes needed), the admin bar for the author role is gone
https://www.screencast.com/t/KibTqiAD5u
So the code works from what I can see.

There would be other methods to remove the WordPress admin bar, try some other solutions or even plugins
https://premium.wpmudev.org/blog/remove-the-wordpress-admin-toolbar/
https://codex.wordpress.org/Function_Reference/show_admin_bar
https://wplift.com/hide-admin-toolbar

Thanks

Post count: 205

Hi,
I buy theme today and this is my first comment.
Yet i have not installed theme, but i want to ask you in advance that if i want to add many codes in functions.php then which file i edit? (Theme or Child theme?)
Thanks

Post count: 20688

Hi,

It would be best to create a child theme in that case, a child theme is provided in the theme package (code folder)
https://forum.tagdiv.com/whats-included/
This is a guide – https://forum.tagdiv.com/the-child-theme-support-tutorial/
The child theme comes with a functions file, enter the codes there.

Thanks

Post count: 205

Thanks.
Should i have to install wp_booster from below path?
C:\Newspaper-tf\patch_9.0_9.0.1\includes\wp_booster
If yes, then what are the steps to install BOOSTER….

Post count: 205

Cloud Templates > Add new receive error (Invalid reply from server endpoint.)
Permalink Settings > save changes (Done, Ok), but still doesn’t works.
Yet Cloud Templates is emty…

Post count: 20688

Those are the patch files, files that were modified from the previous version to the new one.
If you want to update by patch you can use those files. Note that each patch is required if you update from an older version, you cannot skip one update. They are not cumulative, meaning that the last one does not contain all the previous ones.

That issue with the Cloud library was in some cases caused by plugins, you could check that as a first step. We also continually try to improve the plugin, which is in beta phase at the moment. Be sure to check the theme requirements guide as well
https://forum.tagdiv.com/requirements-for-newspaper/

Post count: 205

How can i remove white space around the thumb image?
It looks like this: https://drive.google.com/file/d/1WrfG0WBdYrBdZmY92uvLBW3xjsJIJYfT/view?usp=sharing
and
I want to set it like this: https://drive.google.com/file/d/1rmj3IRaXZz6WSjxK4NzQ-2_aOUgW1fjp/view?usp=sharing
Thanks

Post count: 205

Article top ad doesn’t show in .td-post-template-1
Article bottom ad work well in .td-post-template-1
Tested with below non adscene ad:
<div class=”td-all-devices”>
MY AD CODE
</div>

Post count: 23312

Hello Viju,

Please provide your website URL so I can take a closer look at it and also, so I will be able to provide a more accurate response.

Thanks.

Post count: 205

Yet site is in “Coming soon mode”. So please wait a bit.
I installed “WP GDPR”, but the bar not showing if i visit my website.
Is there any settings i missing from theme panel?
Thanks

Post count: 23312

Hello Viju,

As for the GDPR settings, I’m not sure what you mean. Our theme is GDPR compliant but does not provide any ‘settings’ in this regard. WordPress itself does not have any settings because there are none to provide.

Thanks.

Viewing 14 posts - 1 through 14 (of 14 total)
The forum ‘Newspaper’ is closed to new topics and replies.