Skip to content

Instantly share code, notes, and snippets.

@pasadamedia
Created February 8, 2015 04:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pasadamedia/aa6e9d54ff2bec925709 to your computer and use it in GitHub Desktop.
Save pasadamedia/aa6e9d54ff2bec925709 to your computer and use it in GitHub Desktop.
Add "Portfolio" tab to BuddyPress member profile
<?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