@Mods: Remove bp_core_admin_bar_css on Backend
-
Hey,
some time ago i was looking for the best solution to alter the admin-bar.css in BP.
I figured out the following solution which removes the original admin-bar.css and replaces it on a per blog basis with a my-admin-bar.css.
The my-admin-bar.css is only loaded when the user is logged in (i set the option to hide the buddybar from user who are not logged in).
function check_admin_bar() {
global $bp, $wpdb, $current_blog, $doing_admin_bar;
$doing_admin_bar = true;
//remove core admin bar CSS at all times!
remove_action('wp_head', 'bp_core_admin_bar_css', 1);
remove_action('admin_head', 'bp_core_admin_bar_css', 1);
if ( (int) get_site_option( 'hide-loggedout-adminbar' ) && !is_user_logged_in() )
return false;
//add custom CSS only if admin bar is true
if($doing_admin_bar)
add_action('wp_head', 'my_admin_bar_css', 1);
add_action('admin_head', 'my_admin_bar_css', 1);
}
add_action('plugins_loaded','check_admin_bar',99);However i’m not able to remove the original admin_bar.css in the backend! It still loads the original admin_bar.css along with my_admin_bar.css.
Any ideas if i missed some hook or some other suggestions?
You must be logged in to reply to this topic.