create custom tab on my profile and add on home.php
-
Hello,
I have been trying to add 2 tabs on user profile. “posts”,”gallery”
posts : my posted posts. it will display a custom-post-type “user-post”
gallery : my pictures .. or any thing.. it will display a custom-post-type “user-images”// Set up Cutsom BP navigation function my_setup_nav() { global $bp; bp_core_new_nav_item( array( 'name' => __( 'Posts', 'buddypress' ), 'slug' => 'user-posts', 'position' => 19, 'screen_function' => 'jv_user_posts', 'show_for_displayed_user' => true ) ); bp_core_new_nav_item( array( 'name' => __( 'Gallery', 'buddypress' ), 'slug' => 'user-gallery', 'position' => 20, 'screen_function' => 'jv_user_gallery' ) ); // Change the order of menu items $bp->bp_nav['messages']['position'] = 100; // Remove a menu item $bp->bp_nav['activity'] = false; $bp->bp_nav['blogs'] = false; // Change name of menu item $bp->bp_nav['groups']['name'] = 'community'; } add_action( 'bp_setup_nav', 'my_setup_nav' ); // Load a page template function jv_user_posts() { bp_core_load_template( 'buddypress/bp/cst-user-posts' ); } function jv_user_gallery() { bp_core_load_template( 'buddypress/bp/cst-user-gallery' ); }
it has successfully created 2 tabs! works ok!BUT it goes to own “cst-user-posts.php” page and “cst-user-gallery.php” page.
I mean I want to add them in /buddypress/members/sigle/home.php file
I guess the part is here on home.php
‘
<?php do_action( ‘bp_before_member_body’ );
if ( bp_is_user_activity() || !bp_current_component() ) :
bp_get_template_part( ‘members/single/activity’ );elseif ( bp_is_user_blogs() ) :
bp_get_template_part( ‘members/single/blogs’ );elseif ( bp_is_user_friends() ) :
bp_get_template_part( ‘members/single/friends’ );elseif ( bp_is_user_groups() ) :
bp_get_template_part( ‘members/single/groups’ );elseif ( bp_is_user_messages() ) :
bp_get_template_part( ‘members/single/messages’ );elseif ( bp_is_user_profile() ) :
bp_get_template_part( ‘members/single/profile’ );elseif ( bp_is_user_forums() ) :
bp_get_template_part( ‘members/single/forums’ );elseif ( bp_is_user_notifications() ) :
bp_get_template_part( ‘members/single/notifications’ );elseif ( bp_is_user_settings() ) :
bp_get_template_part( ‘members/single/settings’ );// If nothing sticks, load a generic template
else :
bp_get_template_part( ‘members/single/plugins’ );endif;
do_action( ‘bp_after_member_body’ ); ?>
‘
How can I make “if” condition for those 2 pages?
I don’t know how to create “bp_is_user_posts” or “bp_is_user_posts” functions.
if I could, I just need to add … if conditions.Please advice me!
Thanks,
pulla
- The topic ‘create custom tab on my profile and add on home.php’ is closed to new replies.