Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: How do I edit the Adminbar?

The article is pretty clearly written really.

It says look at the bp-core-adminbar.php file as a point of reference, here is where the menus are constructed and clue you in to how they are added to the actual pages via the action hooks.

If you simply wanted to remove an action as the page describes you would simply add an opposite action i.e:

remove_action(‘bp_adminbar_menus’, ‘bp_adminbar_blogs_menu’, 6);

Further it explains that you can now create a new function based on the existing one and is where examining the original file is useful, you can simply copy the whole function bp_adminbar_blogs_menu() paste it into a child themes function.php file rename the function slightly bp_my_adminbar_blogs_menu() make whatever modifications you want within the function then add itback into the mix via a new add_action so you remove original:

remove_action(‘bp_adminbar_menus’, ‘bp_adminbar_blogs_menu’, 6);

## create new function ##
function bp_my_adminbar_blogs_menu() {

}
## add new function to admin menubar ##
add_action(‘bp_adminbar_menus’, ‘bp_my_adminbar_blogs_menu’, 6);

You add mods such as this to functions.php file as this way you ensure that you do not have to continually re-write them in a core file, core files should never be changed as each new BP version will replace the files and any adjustments will be lost, working in a child theme ensures these changes are preserved and continue to work after version upgrades.

Skip to toolbar