Last active
February 3, 2020 17:05
-
-
Save imath/e964da41a85b9e76b679fb946114219c to your computer and use it in GitHub Desktop.
Edit BuddyPress primary nav so that profile primary item is before the activity primary item
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* BuddyPress 2.6.0 introduced a new nav API | |
* with a Backcompat mechanism. But accessing/editing | |
* deprecated globals can lead to such problems... | |
* | |
* It's too bad Theme designers forget to test betas :) | |
*/ | |
function strothi_profile_primary_nav_first() { | |
buddypress()->members->nav->edit_nav( array( | |
'position' => 6, | |
), 'profile' ); | |
} | |
add_action( 'bp_xprofile_setup_nav', 'strothi_profile_primary_nav_first' ); | |
// You'll probably need to also have the profile defined as default component.. | |
function strothi_profile_as_front_page() { | |
if ( defined( 'BP_DEFAULT_COMPONENT' ) ) { | |
return; | |
} | |
define( 'BP_DEFAULT_COMPONENT', 'profile' ); | |
} | |
add_action( 'bp_init', 'strothi_profile_as_front_page', 5 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Another detail, about the first function action filter.
bp_xprofile_setup_nav
doesn't exist and the function can't workIf you use this in addition with priority, it does:
add_action( 'bp_setup_nav', 'strothi_profile_primary_nav_first',999 );
I'm also curious to know how to move tabs on a group page ? Seems to use a completely different syntax which i'm unable to write correctly. Merci ! ;-)