bp_core_admin_tabs

Output the tabs in the admin area.

Description

bp_core_admin_tabs( (string) $active_tab = '' ); 

Parameters (1)

0. $active_tab — Optional. (string) => ''
Name of the tab that is active. Optional.

Usage

  1. if ( !function_exists( 'bp_core_admin_tabs' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-core/admin/bp-core-admin-functions.php'; 
  3.  
  4. // Name of the tab that is active. Optional. 
  5. $active_tab = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bp_core_admin_tabs($active_tab); 
  9.  

Defined (1)

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

/bp-core/admin/bp-core-admin-functions.php  
  1. function bp_core_admin_tabs( $active_tab = '' ) { 
  2. $tabs_html = ''; 
  3. $idle_class = 'nav-tab'; 
  4. $active_class = 'nav-tab nav-tab-active'; 
  5.  
  6. /** 
  7. * Filters the admin tabs to be displayed. 
  8. * @since 1.9.0 
  9. * @param array $value Array of tabs to output to the admin area. 
  10. */ 
  11.  
  12. // Loop through tabs and build navigation. 
  13. foreach ( array_values( $tabs ) as $tab_data ) { 
  14. $is_current = (bool) ( $tab_data['name'] == $active_tab ); 
  15. $tab_class = $is_current ? $active_class : $idle_class; 
  16. $tabs_html .= '<a href="' . esc_url( $tab_data['href'] ) . '" class="' . esc_attr( $tab_class ) . '">' . esc_html( $tab_data['name'] ) . '</a>'; 
  17.  
  18. echo $tabs_html; 
  19.  
  20. /** 
  21. * Fires after the output of tabs for the admin area. 
  22. * @since 1.5.0 
  23. */