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 Description

When wp_nav_menu() is used, this function helps to highlight the current BP parent page during nav menu generation.


Parameters Parameters

$retval

(Required) CSS classes for the current nav menu item in the menu.

$item

(Required) The properties for the current nav menu item.


Top ↑

Return Return

(array)


Top ↑

Source 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;
}

Top ↑

Changelog Changelog

Changelog
Version Description
2.2.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.