-
-
Save toluaddy/c1d341f020bec0e0eb98b1b027b65b55 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