cptui_taxonomies_dropdown

Construct a dropdown of our taxonomies so users can select which to edit.

Description

cptui_taxonomies_dropdown( (array) $taxonomies = array() ); 

Parameters (1)

0. $taxonomies — Optional. (array) => array()
Array of taxonomies that are registered. Optional.

Usage

  1. if ( !function_exists( 'cptui_taxonomies_dropdown' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'custom-post-type-ui/inc/taxonomies.php'; 
  3.  
  4. // Array of taxonomies that are registered. Optional. 
  5. $taxonomies = array(); 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = cptui_taxonomies_dropdown($taxonomies); 
  9.  

Defined (1)

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

/inc/taxonomies.php  
  1. function cptui_taxonomies_dropdown( $taxonomies = array() ) { 
  2.  
  3. $ui = new cptui_admin_ui(); 
  4.  
  5. if ( ! empty( $taxonomies ) ) { 
  6. $select = array(); 
  7. $select['options'] = array(); 
  8.  
  9. foreach ( $taxonomies as $tax ) { 
  10. $text = ( ! empty( $tax['label'] ) ) ? $tax['label'] : $tax['name']; 
  11. $select['options'][] = array( 'attr' => $tax['name'], 'text' => $text ); 
  12.  
  13.  
  14. $select['selected'] = $current; 
  15. echo $ui->get_select_input( array( 
  16. 'namearray' => 'cptui_selected_taxonomy',  
  17. 'name' => 'taxonomy',  
  18. 'selections' => $select,  
  19. 'wrap' => false,  
  20. ) );