Skip to:
Content
Pages
Categories
Search
Top
Bottom

custom nav item tab parent url


  • r123ze
    Participant

    @r123ze

    Hi,

    I’ve created a custom tab called orders for profile members, and i want to create another one but the parent of orders

    currently my tab can be access using this url:

    http://example.com/members/demo/orders

    But i want the “completed”, “pending” new custom tabs to be appended to url of orders tab.

    Not:
    http://example.com/members/admin/completed
    http://example.com/members/admin/pending

    But:
    http://example.com/members/admin/orders/completed
    http://example.com/members/admin/orders/pending

    I tried this:

    Orders tab:

    function profile_tab_orders() {
          global $bp;
          bp_core_new_nav_item( array( 
                'name' => 'All orders', 
                'slug' => 'orders', 
                'screen_function' => 'orders_screen', 
                'position' => 40,
                'parent_url'      => bp_loggedin_user_domain() . '/orders/',
                'parent_slug'     => $bp->profile->slug,
                'default_subnav_slug' => 'orders'
          ) );
    }
    add_action( 'bp_setup_nav', 'profile_tab_orders' );
    
    function orders_screen() {
        add_action( 'bp_template_content', 'orders_content' );
        bp_core_load_template( 'buddypress/members/single/plugins' );
    }
    
    function orders_content() { 
        echo do_shortcode('[orders]');
    }

    Completed tab:

    function profile_tab_orders_completed() {
          global $bp;
          bp_core_new_nav_item( array( 
                'name' => 'completed', 
                'slug' => 'completed', 
                'screen_function' => 'completed_screen', 
                'position' => 40,
                'parent_url' => $bp->loggedin_user->domain . $bp->orders->slug . '/completed',
                'parent_slug' => $bp->orders->slug,
                'default_subnav_slug' => 'completed'
          ) );
    }
    add_action( 'bp_setup_nav', 'profile_tab_completed' );
     
     
    function completed_screen() {
        add_action( 'bp_template_content', 'completed_content' );
        bp_core_load_template( 'buddypress/members/single/plugins' );
    }
    
    function completed_content() { 
        echo do_shortcode('[orders-completed]');
    }

    Can someone suggest me a solution or help me in how to access pending, completed via this url

    /orders/completed

    /orders/pending

    Thanks in advance!

  • You must be logged in to reply to this topic.
Skip to toolbar