bp_customizer_nav_menus_get_items

Populate BuddyPress user nav items for the customizer.

Description

(array) bp_customizer_nav_menus_get_items( (array) $items = array(), (string) $type = '', (string) $object = '', (int) $page = 0 ); 

Returns (array)

The paginated BuddyPress user nav items.

Parameters (4)

0. $items — Optional. (array) => array()
The array of menu items.
1. $type — Optional. (string) => ''
The requested type.
2. $object — Optional. (string) => ''
The requested object name.
3. $page — Optional. (int)
The page num being requested.

Usage

  1. if ( !function_exists( 'bp_customizer_nav_menus_get_items' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-core/bp-core-filters.php'; 
  3.  
  4. // The array of menu items. 
  5. $items = array(); 
  6.  
  7. // The requested type. 
  8. $type = ''; 
  9.  
  10. // The requested object name. 
  11. $object = ''; 
  12.  
  13. // The page num being requested. 
  14. $page = -1; 
  15.  
  16. // NOTICE! Understand what this does before running. 
  17. $result = bp_customizer_nav_menus_get_items($items, $type, $object, $page); 
  18.  

Defined (1)

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

/bp-core/bp-core-filters.php  
  1. function bp_customizer_nav_menus_get_items( $items = array(), $type = '', $object = '', $page = 0 ) { 
  2. if ( 'bp_loggedin_nav' === $object ) { 
  3. } elseif ( 'bp_loggedout_nav' === $object ) { 
  4. } else { 
  5. return $items; 
  6.  
  7. foreach ( $bp_items as $bp_item ) { 
  8. $items[] = array( 
  9. 'id' => "bp-{$bp_item->post_excerpt}",  
  10. 'title' => html_entity_decode( $bp_item->post_title, ENT_QUOTES, get_bloginfo( 'charset' ) ),  
  11. 'type' => $type,  
  12. 'url' => esc_url_raw( $bp_item->guid ),  
  13. 'classes' => "bp-menu bp-{$bp_item->post_excerpt}-nav",  
  14. 'type_label' => _x( 'Custom Link', 'customizer menu type label', buddypress ),  
  15. 'object' => $object,  
  16. 'object_id' => -1,  
  17. ); 
  18.  
  19. return array_slice( $items, 10 * $page, 10 );