Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm having trouble adding sub nav menu items to my parent menu item under Buddy Press.

The parent menu item as shown below, named TEST, shows correctly, but the tabs named SUB NAV and SUB NAV 2 don’t show at all.

function my_setup_nav() { 
global $bp; 
$em_link = $bp->loggedin_user->domain . $bp->account->slug . '/';

# - add parent menu item    

bp_core_new_nav_item( array( 
    'name' =>  'TEST',
    'slug' =>  $bp->account->slug, 
    'position' => 10,
    ) 
); 

# - add sub nav menu items

bp_core_new_subnav_item( array( 
    'name' => 'SUB NAV',
    'slug' => 'account-sub', 
    'parent_url' =>  $em_link ,
    'parent_slug' => $bp->account->slug,
    'position' => 10,
    'item_css_id' => 'xx' 
    ) 
); 
bp_core_new_subnav_item( array( 
    'name' => 'SUB NAV 2',
    'slug' => 'account-sub-2', 
    'parent_url' =>  $em_link ,
    'parent_slug' => $bp->account->slug,
    'position' => 20,
    'item_css_id' => 'xx-2' 
    ) 
); 
} 

add_action( 'bp_setup_nav', 'my_setup_nav', 99 );

What's the correct syntax for getting the Sub Navigation items to work correctly?

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

Asked and Answered here: http://buddypress.org/support/topic/create-sub-nav-menu-item-in-profile/

Did you try the suggested solution ?

share|improve this answer
    
I tried adding the screen function with an empty test function to no avail. If I change the slug to $bp->profile->slug then the Sub Nav item appears as a sub item of the Profile Parent tab but seems not to work with my custom added "TEST" parent. It seems like its a slug issue, but whether I am declaring 'slug' => $bp->account->slug or 'slug' => 'account' it still doesn't seem to take. When I dump the $bp global, I can see my parent menu item exists as it should, so that doesn't seem to be the issue. Thanks for your input thus far. –  userabuser Feb 9 '13 at 3:37
    
It turned out to be that the BP custom profile menu plugin was conflicting with my code or vice versa. Disabling that plugin now allows me to manually declare parent/child items correctly. Thanks for your help. –  userabuser Feb 9 '13 at 6:37
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.