Tagged: buddypress, code, tab
Hello, I’ve tried to reord profile’s tabs using this code inside functions.php as described in this post: https://buddypress.org/support/topic/re-order-profile-menu-items/
the code is:function my_change_profile_tab_order() {
global $bp;$bp->bp_nav[‘settings’][‘position’] = 10;
$bp->bp_nav[‘activity’][‘position’] = 20;
$bp->bp_nav[‘friends’][‘position’] = 30;
$bp->bp_nav[‘groups’][‘position’] = 40;
$bp->bp_nav[‘blogs’][‘position’] = 50;
$bp->bp_nav[‘messages’][‘position’] = 60;
$bp->bp_nav[‘profile’][‘position’] = 70;
}
add_action( ‘bp_setup_nav’, ‘my_change_profile_tab_order’, 999 );I could even test it because the same code appeared at the top of the website so I immediatly removed it.
So: can you suggest me please to code to use to move “blogs” tab at the beginning?
Thanks
TizianoHello Tiziano,
If you want to move blog menu at the beginning. Just modify ‘buddyblog-loader.php’ Find ‘$main_nav’ might be at line no. 102 and replace position number with the number less than 10. It will render blog menu at the beginning. Please let me know if it works or not
Thank You
RaviHello Tiziano,
Sorry for not getting your point. Because you are talking about “blogs” tab. I thought you was talking about BuddyBlog. And, it is not a good idea to change in BuddyPress plugin file. but you can use “BuddyPress Reorder Tabs” plugin by BuddyBoss to accomplish your feature. Hope it will resolve your problem.
Regards
Ravi- This reply was modified 7 years, 1 month ago by Ravi.
Hi Ravi, thanks for your support. I used for weeks buddypress reorder tabs plugin but at least I’ve deactivated it for two reasos:
1. It didn’t work properly on my website (maybe a compatibility issue with another plugin)
2. Too much plugin already installedThat’s why I’m looking for a “code” solution…
Thanks…
TizinaoHi Tiziano,
Ravi has asked me to assist you on this as his hands are full. I will find some time in the day and assist you with the code.Thank you
BrajeshHi Tiziano,
Thank you for the patience.Please remove your code snippet that you are already using.
Then, please put this in your bp-custom.php
/** * Reorder BuddyPress profile tabs/navigation. */ function buddydev_reorder_buddypress_profile_tabs() { $bp = buddypress(); $nav = $bp->members->nav; // it's a map of nav items for user profile to their position. $nav_items = array( 'settings' => 10, 'activity' => 20, 'friends' => 30, 'groups' => 40, 'blogs' => 50, 'messages' => 60, 'profile' => 70, ); foreach ( $nav_items as $nav_item => $position ) { $nav->edit_nav( array( 'position' => $position ), $nav_item ); } } add_action( 'bp_setup_nav', 'buddydev_reorder_buddypress_profile_tabs', 999 );
That will do it for you.
Hope that helps.
Regards
BrajeshDear Brajesh, thank you so much for your help. I’ve tried to use your code on bp-custom.php but the result was this: https://edizioniopen.it/wp-content/uploads/2017/11/Schermata-2017-11-11-alle-15.55.00.png
As you can see, the code appears at the top of the website… 🙁
What can we do?
Thanks!
Tiziano
The topic ‘ [Resolved] Buddypress Profile order Tab’ is closed to new replies.