cptui_settings_tab_menu

Construct and output tab navigation.

Description

cptui_settings_tab_menu( (string) $page = 'post_types' ); 

Parameters (1)

0. $page — Optional. (string) => 'post_types'
Whether it's the CPT or Taxonomy page. Optional. Default post_types..

Usage

  1. if ( !function_exists( 'cptui_settings_tab_menu' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'custom-post-type-ui/custom-post-type-ui.php'; 
  3.  
  4. // Whether it's the CPT or Taxonomy page. Optional. Default "post_types". 
  5. $page = 'post_types'; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = cptui_settings_tab_menu($page); 
  9.  

Defined (1)

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

/custom-post-type-ui.php  
  1. function cptui_settings_tab_menu( $page = 'post_types' ) { 
  2.  
  3. /** 
  4. * Filters the tabs to render on a given page. 
  5. * @since 1.3.0 
  6. * @param array $value Array of tabs to render. 
  7. * @param string $page Current page being displayed. 
  8. */ 
  9. $tabs = (array) apply_filters( 'cptui_get_tabs', array(), $page ); 
  10.  
  11. if ( ! empty( $tabs['page_title'] ) ) { 
  12. printf( 
  13. '<h1>%s</h1><h2 class="nav-tab-wrapper">',  
  14. $tabs['page_title'] 
  15. ); 
  16.  
  17. foreach ( $tabs['tabs'] as $tab ) { 
  18. printf( 
  19. '<a class="%s" href="%s" aria-selected="%s">%s</a>',  
  20. implode( ' ', $tab['classes'] ),  
  21. $tab['url'],  
  22. $tab['aria-selected'],  
  23. $tab['text'] 
  24. ); 
  25.  
  26. echo '</h2>';