Tagged: 

Viewing 5 posts - 1 through 5 (of 5 total)
  • Question

    #56348
    @infomushug

    as I can add one more to the menu option, but in the first place the menu before “activity” .. I want to add an option “home” this will be a page with pictures

    Answers

    #56391

    Anonymous
    @

    Hi @infomushug, Please add this function inside your child theme’s function.php

    change the slug with your page slug you want to display as ‘home’.

    
    function my_setup_nav() {
          global $bp;
    
          bp_core_new_nav_item( array( 
                'name' => __( 'Home', 'buddypress' ), 
                'slug' => 'home', 
                'position' => 1,
                'screen_function' => 'my_item_one_template', 
          ) );
    }
    
    add_action( 'bp_setup_nav', 'my_setup_nav' );
    

    Regards

    #56395
    @infomushug

    thanks Pallavi not understand this part

    my page is called “Home”
    I have it on the menu

    bp_core_new_nav_item( array(
    ‘name’ => __( ‘Home’, ‘buddypress’ ), —-()
    ‘slug’ => ‘home’, —–(who settled here??)
    ‘position’ => 1,
    ‘screen_function’ => ‘my_item_one_template’, —–(who settled here??)
    ) );

    #56402
    @infomushug

    @pallavi
    and this “Home” first
    IMG — 14

    ,, but clicking an error 404

    what I need is that the page “home” is active at the beginning

    page “HOME” .—IMG 13

    help me, thanks

    #56429
    @vapvarun

    Hi @infomushug, These are BuddyPress specific queries
    you can also consul them inside BuddyPress forum https://buddypress.org/support/
    You will need to create proper screen function code which depends upon what functionality you need there.

    A sample code

    
    function add_animal_tabs() {
    	global $bp;
    	
    	bp_core_new_nav_item( array(
    		'name'                  => 'Animals',
    		'slug'                  => 'animals',
    		'parent_url'            => $bp->displayed_user->domain,
    		'parent_slug'           => $bp->profile->slug,
    		'screen_function'       => 'animals_screen',			
    		'position'              => 200,
    		'default_subnav_slug'   => 'animals'
    	) );
    		
    	bp_core_new_subnav_item( array(
    		'name'              => 'Dogs',
    		'slug'              => 'dogs',
    		'parent_url'        => trailingslashit( bp_displayed_user_domain() . 'animals' ),
    		'parent_slug'       => 'animals',
    		'screen_function'   => 'dogs_screen',
    		'position'          => 100,
    		'user_has_access'   => bp_is_my_profile()
    	) );		
    
    	bp_core_new_subnav_item( array(
    		'name'              => 'Cats',
    		'slug'              => 'cats',
    		'parent_url'        => trailingslashit( bp_displayed_user_domain() . 'animals' ),
    		'parent_slug'       => 'animals',
    		'screen_function'   => 'cats_screen',
    		'position'          => 150,
    		'user_has_access'   => bp_is_my_profile()
    	) );	
    
    }
    add_action( 'bp_setup_nav', 'add_animal_tabs', 100 );
    
    function animals_screen() {
        add_action( 'bp_template_content', 'animals_screen_content' );
        bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
    }
    function animals_screen_content() { 
    	echo 'Animals<br/>';
    }
    
    function dogs_screen() {
        add_action( 'bp_template_content', 'dogs_screen_content' );
        bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
    }
    function dogs_screen_content() { 
    	echo 'Dogs'; 
    }
    
    function cats_screen() {
        add_action( 'bp_template_content', 'cats_screen_content' );
        bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
    }
    function cats_screen_content() { 
    	echo 'Cats'; 
    }
    

    Regards
    Varun Dubey

Viewing 5 posts - 1 through 5 (of 5 total)
  • The question ‘Profile menu’ is closed to new replies.