Created
February 8, 2015 04:02
-
-
Save pasadamedia/aa6e9d54ff2bec925709 to your computer and use it in GitHub Desktop.
Add "Portfolio" tab to BuddyPress member profile
This file contains hidden or 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 | |
/** | |
* Add a new "Portfolio" profile tab and load content. | |
* | |
* @link http://premium.wpmudev.org/forums/topic/buddypress-adding-custom-page-tab | |
* | |
*/ | |
add_action( 'bp_setup_nav', 'pasada_profile_portfolio', 50 ); | |
function pasada_profile_portfolio() { | |
global $bp; | |
bp_core_new_nav_item( | |
array( | |
'name' => __( 'Portfolio', 'buddypress' ), | |
'slug' => 'portfolio', | |
'position' => 20, | |
'screen_function' => 'pasada_profile_portfolio_template', | |
'default_subnav_slug' => 'portfolio', | |
'parent_url' => $bp->loggedin_user->domain . $bp->slug . '/', | |
'parent_slug' => $bp->slug | |
) ); | |
} | |
function pasada_profile_portfolio_template() { | |
//add title and content here - last is to call the members plugin.php template | |
add_action( 'bp_template_title', 'pasada_portfolio_title' ); | |
add_action( 'bp_template_content', 'pasada_portfolio_content' ); | |
bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) ); | |
} | |
function pasada_portfolio_title() { | |
echo 'Portfolio'; | |
} | |
function pasada_portfolio_content() { | |
echo 'This is my portfolio'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment