bp_nav_item_has_subnav

Filters whether or not a given nav item has subnav items.

Description

apply_filters( 'bp_nav_item_has_subnav', (bool) $has_subnav, (string) $nav_item ); 

Parameters (2)

0. $has_subnav (bool)
Whether or not there is any subnav items.
1. $nav_item (string)
The slug of the top-level nav item whose subnav items you're checking.

Usage

To run the hook, copy the example below.
  1. $has_subnav = apply_filters( 'bp_nav_item_has_subnav', $has_subnav, $nav_item ); 
  2.  
  3. if ( !empty( $has_subnav ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the bp_nav_item_has_subnav callback 
  2. function filter_bp_nav_item_has_subnav( $has_subnav, $nav_item ) { 
  3. // make filter magic happen here... 
  4. return $has_subnav
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'bp_nav_item_has_subnav', 'filter_bp_nav_item_has_subnav', 10, 2 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'bp_nav_item_has_subnav', 'filter_bp_nav_item_has_subnav', 10, 2 ); 

Defined (1)

The filter is defined in the following location(s).

/bp-core/bp-core-buddybar.php  
  1. return apply_filters( 'bp_nav_item_has_subnav', $has_subnav, $nav_item );