Skip to:
Content
Pages
Categories
Search
Top
Bottom

Registering Naviatgation Documentation

  • @belogical

    Participant

    http://codex.buddypress.org/developer-docs/creating-a-custom-buddypress-component/registering-the-navigation/

    Mods/Andy, I’ve updated this codex article if you want to copy/paste and save some time. Works fine on my test site. I updated with changes around $bp global.

    function bp_component_setup_nav() {
    global $bp;
    
    	/* Add the component to the main navigation item list */
    bp_core_add_nav_item( __( 'Component', 'bp-component' ), $bp->component->slug );
    bp_core_add_nav_default( $bp->component->slug, 'bp_component_screen_subnav1', 'subnav-1' );
    
    	$component_link = $bp->loggedin_user->domain . $bp->component->slug . '/';
    
    	/* Add the subnav items to the main component nav item */
    bp_core_add_subnav_item( $bp->component->slug, 'subnav-1', __( 'Component Sub Nav 1', 'bp-component' ), $component_link, 'bp_component_screen_subnav1', 'subnav-1' );
    bp_core_add_subnav_item( $bp->component->slug, 'subnav-2', __( 'Component Sub Nav 2', 'bp-component' ), $component_link, 'bp_component_screen_subnav2', 'subnav-2' );
    
    	if ( $bp->current_component == $bp->component->slug ) {
    if ( bp_is_home() ) {
    $bp->bp_options_title = __( 'My Component Title', 'bp-component' );
    } else {
    $bp->bp_options_avatar = bp_core_get_avatar( $bp->displayed_user->id, 1 );
    $bp->bp_options_title = $bp->displayed_user->fullname;
    }
    }
    }
    add_action( 'wp', 'bp_component_setup_nav', 2 );
    add_action( 'admin_menu', 'bp_component_setup_nav', 2 );
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Registering Naviatgation Documentation’ is closed to new replies.
Skip to toolbar