bp_core_menu_highlight_nav_menu_item( array $retval, WP_Post $item )
Adds current page CSS classes to the parent BP page in a WP Nav Menu.
Description
When wp_nav_menu() is used, this function helps to highlight the current BP parent page during nav menu generation.
Parameters
- $retval
-
(Required) CSS classes for the current nav menu item in the menu.
- $item
-
(Required) The properties for the current nav menu item.
Return
(array)
Source
File: bp-core/bp-core-filters.php
function bp_core_menu_highlight_nav_menu_item( $retval, $item ) {
// If we're not on a BP page or if the current nav item is not a page, stop!
if ( ! is_buddypress() || 'page' !== $item->object ) {
return $retval;
}
// Get the WP page.
$page = get_post( $item->object_id );
// See if we should add our highlight CSS classes for the page.
$retval = bp_core_menu_highlight_parent_page( $retval, $page );
return $retval;
}
Changelog
| Version | Description |
|---|---|
| BuddyPress 2.2.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.