Fairweb

Développement WordPress, WordPress Mu, BuddyPress

bp_logo

BuddyPress adminbar : replacing the sitename by a logo

| 0 comments

In BuddyPress’ adminbar, the first link is actually the site name.

I you want to replace the name by a logo, you should not touch the BP core file that builds this menu nor the parent theme (bp-sn-parent) otherwise your modifications will be lost on the next upgrade.

The solution is to open the fonctions.php file of your child-theme (default is bp-default) and add the following code :
function my_adminbar_logo () {
global $bp;
echo '<a href="' . $bp->root_domain . '" id="admin-bar-logo"><img src="http://s.wordpress.org/about/images/smbutton-blue-bg.png" alt="logo" title="logo" /></a>';
}
remove_action('bp_adminbar_logo','bp_adminbar_logo');
add_action('bp_adminbar_logo','my_adminbar_logo');

by replacing the src attribute value of the img tag by your logo’s url.

Originally, the function displaying this link is called bp_adminbar_logo by an action with the same name. What we did is simply remove this function from the bp_adminbar_logo action and then add another function to this action, here my_adminbar_logo.

Share

Author: Fairweb

Développement php/mysql, conception de sites internet

Leave a Reply

Required fields are marked *.

*