6 years ago
I’ve been searching through posts on here and through Google for days but can’t find a clear answer to this questsion.
I want to edit the links in the navigation, userbar and optionbar menu, to add new ones and remove ones that I don’t want to use.
I can’t seem to find the code that renders all of these, are they in a file I can edit?
This is being handled with functions like these:
All of these functions (and a lot more) can be found in buddypress/bp-core.php. They are well documented and you can always have a look at the various core component how they use these functions.
To the admin bar you can add links like so:
$link = '<li><a href="'. $bp->loggedin_user->domain . 'my-page" title="'. __( 'My Page') .'">'. __( 'My Page') .'</a></li>';
add_action( 'bp_adminbar_menus', 'sv_add_link' );
Removing links also works with actions. Using the example from above you’d have to put this into your functions.php file:
remove_action( 'bp_adminbar_menus', 'sv_add_link' )
You have to remove an action at the same priority as it has been added, so if you find an add_action call like this:
add_action( 'bp_adminbar_menus', 'sv_add_link' , 7 );
you’d have to remove it with this:
remove_action( 'bp_adminbar_menus', 'sv_add_link' , 7 );
Otherwise it won’t work.
Hope this helps you along a bit.
Hi, this is exactly what I have been looking for! Thanks very much!
Follow BuddyPress on Twitter •
Contact Us •
Terms of Service