Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: What is the correct way to alter the admin-bar.css


21cdb
Participant

@21cdb

Hey r-a-y,

it seems it was a problem about when you trigger the remove and the add action.

Therefor i put everything in its own function which apllies after every hook is triggered:

// **** Custom BuddyPress admin-bar.css called my-admin-bar.css, stored in template directory ********

function my_admin_bar_css() { ?>

<link href=”<?php bloginfo(‘template_url’); ?>/css/my-admin-bar.css” rel=”stylesheet” type=”text/css” media=”screen,projection” />

<?php

$doing_admin_bar = false;

}

function trigger_adminbar_hooks(){

remove_action(‘bp_adminbar_logo’, ‘bp_adminbar_logo’);

remove_action(‘wp_head’, ‘bp_core_admin_bar_css’, 1);

add_action(‘bp_adminbar_menus’, ‘bp_adminbar_custom_logo’, 1 );

add_action(‘wp_head’, ‘my_admin_bar_css’, 1);

}

add_action(‘plugins_loaded’,’trigger_adminbar_hooks’,99);

?>

I’m going to try your solution. Would be great to know how to apply the my-admin-bar.css only when the adminbar is displayed. I’m glad about your solution for the moment, but there should also be a more correct way for the future!

Skip to toolbar