Skip to:
Content
Pages
Categories
Search
Top
Bottom

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


r-a-y
Keymaster

@r-a-y

Hey 21cdb,

This is actually getting beyond the scope of the original post!

I’m not sure what the $doing_admin_bar variable is; I’m assuming it’s a variable of BP’s that allows you to check if the admin bar is displayed or not.

If that is the case, you can try this:

function check_admin_bar() {
global $bp;
if($doing_admin_bar) add_action('wp_head', 'my_admin_bar_css', 1);
else remove_action('wp_head', 'bp_core_admin_bar_css', 1);
}
add_action('plugins_loaded','check_admin_bar',99);

Try that out, not sure if it will work though!

Re: Admin bar logo. Simple way is to not use the apply_filter! Just directly link to your logo!

function my_adminlogo() {
echo '<a href="/"><img src="LINK TO LOGO" alt="YOUR LOGO" /></a>';
}

function my_adminbar_logo() {
//replace BP logo with your logo
remove_action( 'bp_adminbar_logo', 'bp_adminbar_logo');
add_action( 'bp_adminbar_logo', 'my_adminlogo');
}

add_action( 'bp_adminbar_logo', 'my_adminbar_logo', 1);

To do more modifications, I highly recommend reading the codex article, “Modifying the Admin Bar” that Jeff linked to:

https://codex.buddypress.org/how-to-guides/modifying-the-buddypress-admin-bar/

It contains mostly everything you need to know!

Skip to toolbar