cptui_get_taxonomy_code

Display our copy-able code for registered taxonomies.

Description

cptui_get_taxonomy_code( (array) $cptui_taxonomies = array(), (bool) $single = false ); 

Parameters (2)

0. $cptui_taxonomies — Optional. (array) => array()
Array of taxonomies to render. Optional.
1. $single — Optional. (bool) => false
Whether or not we are rendering a single taxonomy. Optional. Default false.

Usage

  1. if ( !function_exists( 'cptui_get_taxonomy_code' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'custom-post-type-ui/inc/tools.php'; 
  3.  
  4. // Array of taxonomies to render. Optional. 
  5. $cptui_taxonomies = array(); 
  6.  
  7. // Whether or not we are rendering a single taxonomy. Optional. Default false. 
  8. $single = false; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = cptui_get_taxonomy_code($cptui_taxonomies, $single); 
  12.  

Defined (1)

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

/inc/tools.php  
  1. function cptui_get_taxonomy_code( $cptui_taxonomies = array(), $single = false ) { 
  2. if ( ! empty( $cptui_taxonomies ) ) { 
  3. $callback = 'cptui_register_my_taxes'; 
  4. if ( $single ) { 
  5. $key = key( $cptui_taxonomies ); 
  6. $callback = 'cptui_register_my_taxes_' . str_replace( '-', '_', $cptui_taxonomies[ $key ]['name'] ); 
  7. ?> 
  8. function <?php echo $callback; ?>() { 
  9. <?php 
  10. foreach ( $cptui_taxonomies as $tax ) { 
  11. } ?> 
  12.  
  13. add_action( 'init', '<?php echo $callback; ?>' ); 
  14. <?php 
  15. } else { 
  16. _e( 'No taxonomies to display at this time', 'custom-post-type-ui' );