BP_Core_BP_Nav_BackCompat::get_component_nav( string $offset = '' )
Get the BP_Core_Nav object corresponding to the component, based on a nav item name.
Description
The way bp_nav was previously organized makes it impossible to know for sure which component’s nav is being referenced by a given nav item name. We guess in the following manner:
- If we’re looking at a group, and the nav item name (
$offset
) is the same as the slug of the current group, we assume that the proper component nav is ‘groups’. - Otherwise, fall back on ‘members’.
Parameters
- $offset
-
(Optional) Nav item name.
Default value: ''
Return
Source
File: bp-core/classes/class-bp-core-bp-nav-backcompat.php
protected function get_component_nav( $offset = '' ) { $component = $this->get_component( $offset ); $bp = buddypress(); if ( ! isset( $bp->{$component}->nav ) ) { return false; } return $bp->{$component}->nav; }
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.