BP_Core_Nav::add_nav( array $args )
Adds a new nav item.
Description
Parameters
- $args
-
(Required) The nav item's arguments.
Return
Source
File: bp-core/classes/class-bp-core-nav.php
public function add_nav( $args ) {
if ( empty( $args['slug'] ) ) {
return false;
}
// We have a child and the parent exists.
if ( ! empty( $args['parent_slug'] ) ) {
$slug = $args['parent_slug'] . '/' . $args['slug'];
$args['secondary'] = true;
// This is a parent.
} else {
$slug = $args['slug'];
$args['primary'] = true;
}
// Add to the nav.
$this->nav[ $this->object_id ][ $slug ] = new BP_Core_Nav_Item( $args );
return $this->nav[ $this->object_id ][ $slug ];
}
Changelog
| Version | Description |
|---|---|
| BuddyPress 2.6.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.