How to make the admin bar transparent?
-
Hi
I would like to make my adminbar transparent. Is it possible?
screenshotThanks in advance
-
Adding this to your style.css in child theme should work:
#wpadminbar { background: transparent; }
It works fine! Thank you very much!
🙂
With your code and the use of the plugin Better Admin Bar I have made a nice unobtrusive admin bar.
Any idea how to hide/remove the dashboard link for NON-admins? Thanks.You can remove access to the WP admin bar by non admins using this in your functions.php file:
function restrict_dashboard_access() { if ( is_admin() && ! current_user_can( 'administrator' ) && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) { wp_redirect( home_url() ); exit; } } add_action( 'init', 'restrict_dashboard_access' );
Also to remove the bar itself for non admins put this in your functions.php :
function remove_admin_bar() { if ( !current_user_can( 'administrator' ) && !is_super_admin() ) { show_admin_bar(false); } } add_action( 'after_setup_theme', 'remove_admin_bar' );
Sorry, I didn’t explain it well: I want to keep the admin bar for non-admins (it is usefull for the notifications etc) but make disappear the word “Pretitude” (that gives access to dashboard).
Well, after using your code, non-admins don’t have access to dashboard any more, but the word Pretitude stays visible and points to the home page. This word been now useless, I want to hide it for esthetical reasons, because it is near the logo and the whole thing is ungly. Is that possible?Thanks again for the code!
Yeah it’s possible 🙂 (assuming that the bit you are talking about is the one im thinking of haha).
Two methods:
1. CSS
li#wp-admin-bar-site-name { display: none; }
2. Add this to functions.php file
function remove_site_name( $wp_admin_bar ) { $wp_admin_bar->remove_node( 'site-name' ); } add_action( 'admin_bar_menu', 'remove_site_name', 999 );
Both will hide the word for both ALL users including admins (I prefer the second but its up to you).
If you want to leave the word Pretitude there for admins only to access the dashboard then adding an if statement into the function (similar to the one in the
remove_admin_bar()
function) should work.Hope it works!
Wow, it works like a charm! Thank you very much and have a nice day!
You too 🙂
- You must be logged in to reply to this topic.