Reply To: how display content in submenu?
Read here:
Here a working example you can study to understand (and use to see how it works)
function bpfr_post_profile_setup_nav() {
global $bp;
$parent_slug = 'audio';
$child_slug = 'posts_sub';
$post_count = count_user_posts( bp_displayed_user_id(), array('post', 'post' ) );
//Add nav item with posts count
bp_core_new_nav_item( array(
'name' => __( 'Audios' ) .'<span>'.$post_count.'</span>',
'slug' => $parent_slug,
'screen_function' => 'bpfr_profile_post_screen',
'position' => 40,
'default_subnav_slug' => $child_slug
) );
//Add subnav item
bp_core_new_subnav_item( array(
'name' => __( 'My latest audios' ),
'slug' => $child_slug,
'parent_url' => $bp->loggedin_user->domain . $parent_slug.'/',
'parent_slug' => $parent_slug,
'screen_function' => 'bpfr_profile_post_screen'
) );
}
function bpfr_profile_post_screen() {
add_action( 'bp_template_content', 'bpfr_profile_post_screen_content' );
bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
}
function bpfr_profile_post_screen_content() {
do_action( 'my_profile_post' );
}
add_action( 'bp_setup_nav', 'bpfr_post_profile_setup_nav' );
And here a content test:
function luisa_conteni() {
echo 'Forza BuddyPress';
}
add_action( 'my_profile_post', 'luisa_conteni' );
Add all snippets to bp-custom.php.
The example use the default plugin template (/members/single/plugin.php) as generally there is no need to create a new template while on a profile (except if you need something very specific like a table or a an iframe).