BP_Component::setup_nav( array $main_nav = array(), array $sub_nav = array() )
Set up component navigation.
Description
See also
- bp_core_new_nav_item(): For a description of the $main_nav parameter formatting.
- bp_core_new_subnav_item(): For a description of how each item in the $sub_nav parameter array should be formatted.
Parameters
- $main_nav
-
(array) (Optional) Passed directly to bp_core_new_nav_item(). See that function for a description.
Default value: array()
- $sub_nav
-
(array) (Optional) Multidimensional array, each item in which is passed to bp_core_new_subnav_item(). See that function for a description.
Default value: array()
Source
File: bp-core/classes/class-bp-component.php
public function setup_nav( $main_nav = array(), $sub_nav = array() ) { // No sub nav items without a main nav item. if ( !empty( $main_nav ) ) { bp_core_new_nav_item( $main_nav, 'members' ); // Sub nav items are not required. if ( !empty( $sub_nav ) ) { foreach( (array) $sub_nav as $nav ) { bp_core_new_subnav_item( $nav, 'members' ); } } } /** * Fires at the end of the setup_nav method inside BP_Component. * * This is a dynamic hook that is based on the component string ID. * * @since BuddyPress 1.5.0 */ do_action( 'bp_' . $this->id . '_setup_nav' ); }
Changelog
Version | Description |
---|---|
BuddyPress 1.5.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.