bp_core_admin_get_directory_pages

Generate a list of directory pages, for use when building Components panel markup.

Description

(array) bp_core_admin_get_directory_pages(); 

Returns (array)


Usage

  1. if ( !function_exists( 'bp_core_admin_get_directory_pages' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-core/admin/bp-core-admin-slugs.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = bp_core_admin_get_directory_pages(); 
  7.  

Defined (1)

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

/bp-core/admin/bp-core-admin-slugs.php  
  1. function bp_core_admin_get_directory_pages() { 
  2. $bp =buddypress); 
  3. $directory_pages = array(); 
  4.  
  5. // Loop through loaded components and collect directories. 
  6. if ( is_array( $bp->loaded_components ) ) { 
  7. foreach( $bp->loaded_components as $component_slug => $component_id ) { 
  8.  
  9. // Only components that need directories should be listed here. 
  10. if ( isset( $bp->{$component_id} ) && !empty( $bp->{$component_id}->has_directory ) ) { 
  11.  
  12. // The component->name property was introduced in BP 1.5, so we must provide a fallback. 
  13. $directory_pages[$component_id] = !empty( $bp->{$component_id}->name ) ? $bp->{$component_id}->name : ucwords( $component_id ); 
  14.  
  15. /** Directory Display *****************************************************/ 
  16.  
  17. /** 
  18. * Filters the loaded components needing directory page association to a WordPress page. 
  19. * @since 1.5.0 
  20. * @param array $directory_pages Array of available components to set associations for. 
  21. */ 
  22. return apply_filters( 'bp_directory_pages', $directory_pages );