Reorder or rearrange buddypress menu items
-
Can anyone please help me rearranging the BuddyPress menu items. I’ve tried using the below code but it’s not working.I’ve added this code in my child theme’s functions.php but I don’t see any changes.
function bbg_change_profile_tab_order() { global $bp; $bp->bp_nav['profile']['position'] = 10; $bp->bp_nav['activity']['position'] = 20; $bp->bp_nav['blogs']['position'] = 30; $bp->bp_nav['friends']['position'] = 40; $bp->bp_nav['messages']['position'] = 50; $bp->bp_nav['groups']['position'] = 60; $bp->bp_nav['settings']['position'] = 70; } add_action('bp_setup_nav', 'bbg_change_profile_tab_order', 999 );
-
@pratibhasvaksha You can check the following doc
Hi Varun,
Thanks for the reply. The navigation API does not solve my problem. I don’t want to change the inner pages navigation menu. I want to rearrange the menu items in the header under the user profile picture.Rearranging the below menu:
- Dashboard
- Profile
- Notifications
- Messages
- Friends
- Groups
- Settings
- Logout
to the this menu:
- Dashboard
- Groups
- Notifications
- Messages
- Friends
- Profile
- Settings
- Logout
One option would be to use BP Nouveau, it comes with a customizer option to reorder the Nav items.
Hi @venutius,
Thanks for the reply. Could you please elaborate a bit? Are you talking about this function and how we access it using a filter/action?function bp_nouveau_set_nav_item_order( $nav = null, $order = array(), $parent_slug = '' ) { if ( ! is_object( $nav ) || empty( $order ) || ! is_array( $order ) ) { return false; } $position = 0; foreach ( $order as $slug ) { $position += 10; $key = $slug; if ( ! empty( $parent_slug ) ) { $key = $parent_slug . '/' . $key; } $item_nav = $nav->get( $key ); if ( ! $item_nav ) { continue; } if ( (int) $item_nav->position !== (int) $position ) { $nav->edit_nav( array( 'position' => $position ), $slug, $parent_slug ); } } return true; }
Not specifically, I’m just mentioning that for Nouveau if you go to customizer>BP nouveau>Member Navigation you can drag and drop the nav order
- You must be logged in to reply to this topic.