cptui_manage_taxonomies

Create our settings page output.

Description

cptui_manage_taxonomies(); 

Usage

  1. if ( !function_exists( 'cptui_manage_taxonomies' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'custom-post-type-ui/inc/taxonomies.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = cptui_manage_taxonomies(); 
  7.  

Defined (1)

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

/inc/taxonomies.php  
  1. function cptui_manage_taxonomies() { 
  2.  
  3. $tab = ( ! empty( $_GET ) && ! empty( $_GET['action'] ) && 'edit' == $_GET['action'] ) ? 'edit' : 'new'; 
  4. $tab_class = 'cptui-' . $tab; ?> 
  5.  
  6. <div class="wrap <?php echo esc_attr( $tab_class ); ?>"> 
  7.  
  8. <?php 
  9. /** 
  10. * Fires right inside the wrap div for the taxonomy editor screen. 
  11. * @since 1.3.0 
  12. */ 
  13.  
  14. /** 
  15. * Filters whether or not a taxonomy was deleted. 
  16. * @since 1.4.0 
  17. * @param bool $value Whether or not taxonomy deleted. Default false. 
  18. */ 
  19. $taxonomy_deleted = apply_filters( 'cptui_taxonomy_deleted', false ); 
  20.  
  21. // Create our tabs. 
  22. cptui_settings_tab_menu( $page = 'taxonomies' ); 
  23.  
  24. /** 
  25. * Fires below the output for the tab menu on the taxonomy add/edit screen. 
  26. * @since 1.3.0 
  27. */ 
  28.  
  29. if ( 'edit' == $tab ) { 
  30.  
  31. $taxonomies = cptui_get_taxonomy_data(); 
  32.  
  33. $selected_taxonomy = cptui_get_current_taxonomy( $taxonomy_deleted ); 
  34.  
  35. if ( $selected_taxonomy ) { 
  36. if ( array_key_exists( $selected_taxonomy, $taxonomies ) ) { 
  37. $current = $taxonomies[ $selected_taxonomy ]; 
  38.  
  39. $ui = new cptui_admin_ui(); 
  40.  
  41. // Will only be set if we're already on the edit screen. 
  42. if ( ! empty( $taxonomies ) ) { ?> 
  43. <form id="cptui_select_taxonomy" method="post" action="<?php echo esc_url( cptui_get_post_form_action( $ui ) ); ?>"> 
  44. <label for="taxonomy"><?php esc_html_e( 'Select: ', 'custom-post-type-ui' ); ?></label> 
  45. <?php 
  46. cptui_taxonomies_dropdown( $taxonomies ); 
  47.  
  48. /** 
  49. * Filters the text value to use on the select taxonomy button. 
  50. * @since 1.0.0 
  51. * @param string $value Text to use for the button. 
  52. */ 
  53. ?> 
  54. <input type="submit" class="button-secondary" name="cptui_select_taxonomy_submit" value="<?php echo esc_attr( apply_filters( 'cptui_taxonomy_submit_select', esc_attr__( 'Select', 'custom-post-type-ui' ) ) ); ?>" /> 
  55. </form> 
  56. <?php 
  57.  
  58. /** 
  59. * Fires below the taxonomy select input. 
  60. * @since 1.1.0 
  61. * @param string $value Current taxonomy selected. 
  62. */ 
  63. do_action( 'cptui_below_taxonomy_select', $current['name'] ); 
  64. } ?> 
  65.  
  66. <form class="taxonomiesui" method="post" action="<?php echo esc_url( cptui_get_post_form_action( $ui ) ); ?>"> 
  67. <div class="postbox-container"> 
  68. <div id="poststuff"> 
  69. <div class="cptui-section postbox"> 
  70. <button type="button" class="handlediv button-link" aria-expanded="true"> 
  71. <span class="screen-reader-text"><?php esc_html_e( 'Toggle panel: Basic settings', 'custom-post-type-ui' ); ?></span> 
  72. <span class="toggle-indicator" aria-hidden="true"></span> 
  73. </button> 
  74. <h2 class="hndle"> 
  75. <span><?php esc_html_e( 'Basic settings', 'custom-post-type-ui' ); ?></span> 
  76. </h2> 
  77. <div class="inside"> 
  78. <div class="main"> 
  79. <table class="form-table cptui-table"> 
  80. <?php 
  81. echo $ui->get_tr_start() . $ui->get_th_start(); 
  82. echo $ui->get_label( 'name', esc_html__( 'Taxonomy Slug', 'custom-post-type-ui' ) ) . $ui->get_required_span(); 
  83.  
  84. if ( 'edit' == $tab ) { 
  85. echo '<p id="slugchanged" class="hidemessage">' . __( 'Slug has changed', 'custom_post_type_ui' ) . '</p>'; 
  86. echo $ui->get_th_end() . $ui->get_td_start(); 
  87.  
  88. echo $ui->get_text_input( array( 
  89. 'namearray' => 'cpt_custom_tax',  
  90. 'name' => 'name',  
  91. 'textvalue' => ( isset( $current['name'] ) ) ? esc_attr( $current['name'] ) : '',  
  92. 'maxlength' => '32',  
  93. 'helptext' => esc_attr__( 'The taxonomy name/slug. Used for various queries for taxonomy content.', 'custom-post-type-ui' ),  
  94. 'required' => true,  
  95. 'placeholder' => false,  
  96. 'wrap' => false,  
  97. ) ); 
  98.  
  99. echo '<p class="cptui-slug-details">'; 
  100. esc_html_e( 'Slugs should only contain alphanumeric, latin characters. Underscores should be used in place of spaces. Set "Custom Rewrite Slug" field to make slug use dashes for URLs.', 'custom-post-type-ui' ); 
  101. echo '</p>'; 
  102.  
  103. if ( 'edit' == $tab ) { 
  104. echo '<p>'; 
  105. esc_html_e( 'DO NOT EDIT the taxonomy slug unless also planning to migrate terms. Changing the slug registers a new taxonomy entry.', 'custom-post-type-ui' ); 
  106. echo '</p>'; 
  107.  
  108. echo '<div class="cptui-spacer">'; 
  109. echo $ui->get_check_input( array( 
  110. 'checkvalue' => 'update_taxonomy',  
  111. 'checked' => 'false',  
  112. 'name' => 'update_taxonomy',  
  113. 'namearray' => 'update_taxonomy',  
  114. 'labeltext' => esc_html__( 'Migrate terms to newly renamed taxonomy?', 'custom-post-type-ui' ),  
  115. 'helptext' => '',  
  116. 'default' => false,  
  117. 'wrap' => false,  
  118. ) ); 
  119. echo '</div>'; 
  120.  
  121. echo $ui->get_text_input( array( 
  122. 'namearray' => 'cpt_custom_tax',  
  123. 'name' => 'label',  
  124. 'textvalue' => ( isset( $current['label'] ) ) ? esc_attr( $current['label'] ) : '',  
  125. 'aftertext' => esc_html__( '(e.g. Actors)', 'custom-post-type-ui' ),  
  126. 'labeltext' => esc_html__( 'Plural Label', 'custom-post-type-ui' ),  
  127. 'helptext' => esc_attr__( 'Used for the taxonomy admin menu item.', 'custom-post-type-ui' ),  
  128. 'required' => true,  
  129. ) ); 
  130.  
  131. echo $ui->get_text_input( array( 
  132. 'namearray' => 'cpt_custom_tax',  
  133. 'name' => 'singular_label',  
  134. 'textvalue' => ( isset( $current['singular_label'] ) ) ? esc_attr( $current['singular_label'] ) : '',  
  135. 'aftertext' => esc_html__( '(e.g. Actor)', 'custom-post-type-ui' ),  
  136. 'labeltext' => esc_html__( 'Singular Label', 'custom-post-type-ui' ),  
  137. 'helptext' => esc_attr__( 'Used when a singular label is needed.', 'custom-post-type-ui' ),  
  138. 'required' => true,  
  139. ) ); 
  140.  
  141. echo $ui->get_td_end() . $ui->get_tr_end(); 
  142.  
  143. echo $ui->get_tr_start() . $ui->get_th_start() . esc_html__( 'Attach to Post Type', 'custom-post-type-ui' ) . $ui->get_required_span(); 
  144. echo $ui->get_p( esc_html__( 'Add support for available registered post types. At least one is required.', 'custom-post-type-ui' ) ); 
  145. echo $ui->get_th_end() . $ui->get_td_start() . $ui->get_fieldset_start(); 
  146.  
  147. /** 
  148. * Filters the arguments for post types to list for taxonomy association. 
  149. * @since 1.0.0 
  150. * @param array $value Array of default arguments. 
  151. */ 
  152. $args = apply_filters( 'cptui_attach_post_types_to_taxonomy', array( 'public' => true ) ); 
  153.  
  154. // If they don't return an array, fall back to the original default. Don't need to check for empty, because empty array is default for $args param in get_post_types anyway. 
  155. if ( ! is_array( $args ) ) { 
  156. $args = array( 'public' => true ); 
  157. $output = 'objects'; // Or objects. 
  158.  
  159. /** 
  160. * Filters the results returned to display for available post types for taxonomy. 
  161. * @since 1.3.0 
  162. * @param array $value Array of post type objects. 
  163. * @param array $args Array of arguments for the post type query. 
  164. * @param string $output The output type we want for the results. 
  165. */ 
  166. $post_types = apply_filters( 'cptui_get_post_types_for_taxonomies', get_post_types( $args, $output ), $args, $output ); 
  167.  
  168. foreach ( $post_types as $post_type ) { 
  169. $core_label = ( in_array( $post_type->name, array( 
  170. 'post',  
  171. 'page',  
  172. 'attachment',  
  173. ) ) ) ? esc_html__( '(WP Core)', 'custom-post-type-ui' ) : ''; 
  174. echo $ui->get_check_input( array( 
  175. 'checkvalue' => $post_type->name,  
  176. 'checked' => ( ! empty( $current['object_types'] ) && is_array( $current['object_types'] ) && in_array( $post_type->name, $current['object_types'] ) ) ? 'true' : 'false',  
  177. 'name' => $post_type->name,  
  178. 'namearray' => 'cpt_post_types',  
  179. 'textvalue' => $post_type->name,  
  180. 'labeltext' => $post_type->label . ' ' . $core_label,  
  181. 'wrap' => false,  
  182. ) ); 
  183.  
  184. echo $ui->get_fieldset_end() . $ui->get_td_end() . $ui->get_tr_end(); 
  185. ?> 
  186. </table> 
  187. <p class="submit"> 
  188. <?php wp_nonce_field( 'cptui_addedit_taxonomy_nonce_action', 'cptui_addedit_taxonomy_nonce_field' ); 
  189. if ( ! empty( $_GET ) && ! empty( $_GET['action'] ) && 'edit' == $_GET['action'] ) { ?> 
  190. <?php 
  191.  
  192. /** 
  193. * Filters the text value to use on the button when editing. 
  194. * @since 1.0.0 
  195. * @param string $value Text to use for the button. 
  196. */ 
  197. ?> 
  198. <input type="submit" class="button-primary" name="cpt_submit" value="<?php echo esc_attr( apply_filters( 'cptui_taxonomy_submit_edit', esc_attr__( 'Save Taxonomy', 'custom-post-type-ui' ) ) ); ?>" /> 
  199. <?php 
  200.  
  201. /** 
  202. * Filters the text value to use on the button when deleting. 
  203. * @since 1.0.0 
  204. * @param string $value Text to use for the button. 
  205. */ 
  206. ?> 
  207. <input type="submit" class="button-secondary" name="cpt_delete" id="cpt_submit_delete" value="<?php echo esc_attr( apply_filters( 'cptui_taxonomy_submit_delete', __( 'Delete Taxonomy', 'custom-post-type-ui' ) ) ); ?>" /> 
  208. <?php } else { ?> 
  209. <?php 
  210.  
  211. /** 
  212. * Filters the text value to use on the button when adding. 
  213. * @since 1.0.0 
  214. * @param string $value Text to use for the button. 
  215. */ 
  216. ?> 
  217. <input type="submit" class="button-primary cptui-taxonomy-submit" name="cpt_submit" value="<?php echo esc_attr( apply_filters( 'cptui_taxonomy_submit_add', esc_attr__( 'Add Taxonomy', 'custom-post-type-ui' ) ) ); ?>" /> 
  218. <?php } ?> 
  219.  
  220. <?php if ( ! empty( $current ) ) { ?> 
  221. <input type="hidden" name="tax_original" id="tax_original" value="<?php echo esc_attr( $current['name'] ); ?>" /> 
  222. <?php } 
  223.  
  224. // Used to check and see if we should prevent duplicate slugs. ?> 
  225. <input type="hidden" name="cpt_tax_status" id="cpt_tax_status" value="<?php echo esc_attr( $tab ); ?>" /> 
  226. </p> 
  227. </div> 
  228. </div> 
  229. </div> 
  230. <div class="cptui-section postbox"> 
  231. <button type="button" class="handlediv button-link" aria-expanded="true"> 
  232. <span class="screen-reader-text"><?php esc_html_e( 'Toggle panel: Additional labels', 'custom-post-type-ui' ); ?></span> 
  233. <span class="toggle-indicator" aria-hidden="true"></span> 
  234. </button> 
  235. <h2 class="hndle"> 
  236. <span><?php esc_html_e( 'Additional labels', 'custom-post-type-ui' ); ?></span> 
  237. </h2> 
  238. <div class="inside"> 
  239. <div class="main"> 
  240. <table class="form-table cptui-table"> 
  241.  
  242. <?php 
  243. if ( isset( $current['description'] ) ) { 
  244. $current['description'] = stripslashes_deep( $current['description'] ); 
  245. echo $ui->get_textarea_input( array( 
  246. 'namearray' => 'cpt_custom_tax',  
  247. 'name' => 'description',  
  248. 'rows' => '4',  
  249. 'cols' => '40',  
  250. 'textvalue' => ( isset( $current['description'] ) ) ? esc_textarea( $current['description'] ) : '',  
  251. 'labeltext' => esc_html__( 'Description', 'custom-post-type-ui' ),  
  252. 'helptext' => esc_attr__( 'Describe what your taxonomy is used for.', 'custom-post-type-ui' ),  
  253. ) ); 
  254.  
  255. echo $ui->get_text_input( array( 
  256. 'namearray' => 'cpt_tax_labels',  
  257. 'name' => 'menu_name',  
  258. 'textvalue' => ( isset( $current['labels']['menu_name'] ) ) ? esc_attr( $current['labels']['menu_name'] ) : '',  
  259. 'aftertext' => esc_attr__( '(e.g. Actors)', 'custom-post-type-ui' ),  
  260. 'labeltext' => esc_html__( 'Menu Name', 'custom-post-type-ui' ),  
  261. 'helptext' => esc_html__( 'Custom admin menu name for your taxonomy.', 'custom-post-type-ui' ),  
  262. ) ); 
  263.  
  264. echo $ui->get_text_input( array( 
  265. 'namearray' => 'cpt_tax_labels',  
  266. 'name' => 'all_items',  
  267. 'textvalue' => ( isset( $current['labels']['all_items'] ) ) ? esc_attr( $current['labels']['all_items'] ) : '',  
  268. 'aftertext' => esc_attr__( '(e.g. All Actors)', 'custom-post-type-ui' ),  
  269. 'labeltext' => esc_html__( 'All Items', 'custom-post-type-ui' ),  
  270. 'helptext' => esc_html__( 'Used as tab text when showing all terms for hierarchical taxonomy while editing post.', 'custom-post-type-ui' ),  
  271. ) ); 
  272.  
  273. echo $ui->get_text_input( array( 
  274. 'namearray' => 'cpt_tax_labels',  
  275. 'name' => 'edit_item',  
  276. 'textvalue' => ( isset( $current['labels']['edit_item'] ) ) ? esc_attr( $current['labels']['edit_item'] ) : '',  
  277. 'aftertext' => esc_attr__( '(e.g. Edit Actor)', 'custom-post-type-ui' ),  
  278. 'labeltext' => esc_html__( 'Edit Item', 'custom-post-type-ui' ),  
  279. 'helptext' => esc_html__( 'Used at the top of the term editor screen for an existing taxonomy term.', 'custom-post-type-ui' ),  
  280. ) ); 
  281.  
  282. echo $ui->get_text_input( array( 
  283. 'namearray' => 'cpt_tax_labels',  
  284. 'name' => 'view_item',  
  285. 'textvalue' => ( isset( $current['labels']['view_item'] ) ) ? esc_attr( $current['labels']['view_item'] ) : '',  
  286. 'aftertext' => esc_attr__( '(e.g. View Actor)', 'custom-post-type-ui' ),  
  287. 'labeltext' => esc_html__( 'View Item', 'custom-post-type-ui' ),  
  288. 'helptext' => esc_html__( 'Used in the admin bar when viewing editor screen for an existing taxonomy term.', 'custom-post-type-ui' ),  
  289. ) ); 
  290.  
  291. echo $ui->get_text_input( array( 
  292. 'namearray' => 'cpt_tax_labels',  
  293. 'name' => 'update_item',  
  294. 'textvalue' => ( isset( $current['labels']['update_item'] ) ) ? esc_attr( $current['labels']['update_item'] ) : '',  
  295. 'aftertext' => esc_attr__( '(e.g. Update Actor Name)', 'custom-post-type-ui' ),  
  296. 'labeltext' => esc_html__( 'Update Item Name', 'custom-post-type-ui' ),  
  297. 'helptext' => esc_html__( 'Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'custom-post-type-ui' ),  
  298. ) ); 
  299.  
  300. echo $ui->get_text_input( array( 
  301. 'namearray' => 'cpt_tax_labels',  
  302. 'name' => 'add_new_item',  
  303. 'textvalue' => ( isset( $current['labels']['add_new_item'] ) ) ? esc_attr( $current['labels']['add_new_item'] ) : '',  
  304. 'aftertext' => esc_attr__( '(e.g. Add New Actor)', 'custom-post-type-ui' ),  
  305. 'labeltext' => esc_html__( 'Add New Item', 'custom-post-type-ui' ),  
  306. 'helptext' => esc_html__( 'Used at the top of the term editor screen and button text for a new taxonomy term.', 'custom-post-type-ui' ),  
  307. ) ); 
  308.  
  309. echo $ui->get_text_input( array( 
  310. 'namearray' => 'cpt_tax_labels',  
  311. 'name' => 'new_item_name',  
  312. 'textvalue' => ( isset( $current['labels']['new_item_name'] ) ) ? esc_attr( $current['labels']['new_item_name'] ) : '',  
  313. 'aftertext' => esc_attr__( '(e.g. New Actor Name)', 'custom-post-type-ui' ),  
  314. 'labeltext' => esc_html__( 'New Item Name', 'custom-post-type-ui' ),  
  315. 'helptext' => esc_html__( 'Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'custom-post-type-ui' ),  
  316. ) ); 
  317.  
  318. echo $ui->get_text_input( array( 
  319. 'namearray' => 'cpt_tax_labels',  
  320. 'name' => 'parent_item',  
  321. 'textvalue' => ( isset( $current['labels']['parent_item'] ) ) ? esc_attr( $current['labels']['parent_item'] ) : '',  
  322. 'aftertext' => esc_attr__( '(e.g. Parent Actor)', 'custom-post-type-ui' ),  
  323. 'labeltext' => esc_html__( 'Parent Item', 'custom-post-type-ui' ),  
  324. 'helptext' => esc_html__( 'Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'custom-post-type-ui' ),  
  325. ) ); 
  326.  
  327. echo $ui->get_text_input( array( 
  328. 'namearray' => 'cpt_tax_labels',  
  329. 'name' => 'parent_item_colon',  
  330. 'textvalue' => ( isset( $current['labels']['parent_item_colon'] ) ) ? esc_attr( $current['labels']['parent_item_colon'] ) : '',  
  331. 'aftertext' => esc_attr__( '(e.g. Parent Actor:)', 'custom-post-type-ui' ),  
  332. 'labeltext' => esc_html__( 'Parent Item Colon', 'custom-post-type-ui' ),  
  333. 'helptext' => esc_html__( 'Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'custom-post-type-ui' ),  
  334. ) ); 
  335.  
  336. echo $ui->get_text_input( array( 
  337. 'namearray' => 'cpt_tax_labels',  
  338. 'name' => 'search_items',  
  339. 'textvalue' => ( isset( $current['labels']['search_items'] ) ) ? esc_attr( $current['labels']['search_items'] ) : '',  
  340. 'aftertext' => esc_attr__( '(e.g. Search Actors)', 'custom-post-type-ui' ),  
  341. 'labeltext' => esc_html__( 'Search Items', 'custom-post-type-ui' ),  
  342. 'helptext' => esc_html__( 'Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'custom-post-type-ui' ),  
  343. ) ); 
  344.  
  345. echo $ui->get_text_input( array( 
  346. 'namearray' => 'cpt_tax_labels',  
  347. 'name' => 'popular_items',  
  348. 'textvalue' => ( isset( $current['labels']['popular_items'] ) ) ? esc_attr( $current['labels']['popular_items'] ) : null,  
  349. 'aftertext' => esc_attr__( '(e.g. Popular Actors)', 'custom-post-type-ui' ),  
  350. 'labeltext' => esc_html__( 'Popular Items', 'custom-post-type-ui' ),  
  351. 'helptext' => esc_html__( 'Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'custom-post-type-ui' ),  
  352. ) ); 
  353.  
  354. echo $ui->get_text_input( array( 
  355. 'namearray' => 'cpt_tax_labels',  
  356. 'name' => 'separate_items_with_commas',  
  357. 'textvalue' => ( isset( $current['labels']['separate_items_with_commas'] ) ) ? esc_attr( $current['labels']['separate_items_with_commas'] ) : null,  
  358. 'aftertext' => esc_attr__( '(e.g. Separate Actors with commas)', 'custom-post-type-ui' ),  
  359. 'labeltext' => esc_html__( 'Separate Items with Commas', 'custom-post-type-ui' ),  
  360. 'helptext' => esc_html__( 'Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'custom-post-type-ui' ),  
  361. ) ); 
  362.  
  363. echo $ui->get_text_input( array( 
  364. 'namearray' => 'cpt_tax_labels',  
  365. 'name' => 'add_or_remove_items',  
  366. 'textvalue' => ( isset( $current['labels']['add_or_remove_items'] ) ) ? esc_attr( $current['labels']['add_or_remove_items'] ) : null,  
  367. 'aftertext' => esc_attr__( '(e.g. Add or remove Actors)', 'custom-post-type-ui' ),  
  368. 'labeltext' => esc_html__( 'Add or Remove Items', 'custom-post-type-ui' ),  
  369. 'helptext' => esc_html__( 'Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'custom-post-type-ui' ),  
  370. ) ); 
  371.  
  372. echo $ui->get_text_input( array( 
  373. 'namearray' => 'cpt_tax_labels',  
  374. 'name' => 'choose_from_most_used',  
  375. 'textvalue' => ( isset( $current['labels']['choose_from_most_used'] ) ) ? esc_attr( $current['labels']['choose_from_most_used'] ) : null,  
  376. 'aftertext' => esc_attr__( '(e.g. Choose from the most used Actors)', 'custom-post-type-ui' ),  
  377. 'labeltext' => esc_html__( 'Choose From Most Used', 'custom-post-type-ui' ),  
  378. 'helptext' => esc_html__( 'Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'custom-post-type-ui' ),  
  379. ) ); 
  380.  
  381. echo $ui->get_text_input( array( 
  382. 'namearray' => 'cpt_tax_labels',  
  383. 'name' => 'not_found',  
  384. 'textvalue' => ( isset( $current['labels']['not_found'] ) ) ? esc_attr( $current['labels']['not_found'] ) : null,  
  385. 'aftertext' => esc_attr__( '(e.g. No Actors found)', 'custom-post-type-ui' ),  
  386. 'labeltext' => esc_html__( 'Not found', 'custom-post-type-ui' ),  
  387. 'helptext' => esc_html__( 'Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'custom-post-type-ui' ),  
  388. ) ); 
  389.  
  390. echo $ui->get_text_input( array( 
  391. 'namearray' => 'cpt_tax_labels',  
  392. 'name' => 'no_terms',  
  393. 'textvalue' => ( isset( $current['labels']['no_terms'] ) ) ? esc_attr( $current['labels']['no_terms'] ) : null,  
  394. 'aftertext' => esc_html__( '(e.g. No actors)', 'custom-post-type-ui' ),  
  395. 'labeltext' => esc_html__( 'No terms', 'custom-post-type-ui' ),  
  396. 'helptext' => esc_attr__( 'Used when indicating that there are no terms in the given taxonomy associated with an object.', 'custom-post-type-ui' ),  
  397. ) ); 
  398.  
  399. echo $ui->get_text_input( array( 
  400. 'namearray' => 'cpt_tax_labels',  
  401. 'name' => 'items_list_navigation',  
  402. 'textvalue' => ( isset( $current['labels']['items_list_navigation'] ) ) ? esc_attr( $current['labels']['items_list_navigation'] ) : null,  
  403. 'aftertext' => esc_html__( '(e.g. Actors list navigation)', 'custom-post-type-ui' ),  
  404. 'labeltext' => esc_html__( 'Items List Navigation', 'custom-post-type-ui' ),  
  405. 'helptext' => esc_attr__( 'Screen reader text for the pagination heading on the term listing screen.', 'custom-post-type-ui' ),  
  406. ) ); 
  407.  
  408. echo $ui->get_text_input( array( 
  409. 'namearray' => 'cpt_tax_labels',  
  410. 'name' => 'items_list',  
  411. 'textvalue' => ( isset( $current['labels']['items_list'] ) ) ? esc_attr( $current['labels']['items_list'] ) : null,  
  412. 'aftertext' => esc_html__( '(e.g. Actors list)', 'custom-post-type-ui' ),  
  413. 'labeltext' => esc_html__( 'Items List', 'custom-post-type-ui' ),  
  414. 'helptext' => esc_attr__( 'Screen reader text for the items list heading on the term listing screen.', 'custom-post-type-ui' ),  
  415. ) ); 
  416. ?> 
  417. </table> 
  418. </div> 
  419. </div> 
  420. </div> 
  421. <div class="cptui-section postbox"> 
  422. <button type="button" class="handlediv button-link" aria-expanded="true"> 
  423. <span class="screen-reader-text"><?php esc_html_e( 'Toggle panel: Settings', 'custom-post-type-ui' ); ?></span> 
  424. <span class="toggle-indicator" aria-hidden="true"></span> 
  425. </button> 
  426. <h2 class="hndle"> 
  427. <span><?php esc_html_e( 'Settings', 'custom-post-type-ui' ); ?></span> 
  428. </h2> 
  429. <div class="inside"> 
  430. <div class="main"> 
  431. <table class="form-table cptui-table"> 
  432. <?php 
  433.  
  434. $select = array( 
  435. 'options' => array( 
  436. array( 'attr' => '0', 'text' => esc_attr__( 'False', 'custom-post-type-ui' ) ),  
  437. array( 
  438. 'attr' => '1',  
  439. 'text' => esc_attr__( 'True', 'custom-post-type-ui' ),  
  440. 'default' => 'true' 
  441. ),  
  442. ),  
  443. ); 
  444. $selected = ( isset( $current ) ) ? disp_boolean( $current['public'] ) : ''; 
  445. $select['selected'] = ( ! empty( $selected ) ) ? $current['public'] : ''; 
  446. echo $ui->get_select_input( array( 
  447. 'namearray' => 'cpt_custom_tax',  
  448. 'name' => 'public',  
  449. 'labeltext' => esc_html__( 'Public', 'custom-post-type-ui' ),  
  450. 'aftertext' => esc_html__( '(default: true) Whether or not the taxonomy should be publicly queryable.', 'custom-post-type-ui' ),  
  451. 'selections' => $select,  
  452. ) ); 
  453.  
  454. $select = array( 
  455. 'options' => array( 
  456. array( 
  457. 'attr' => '0',  
  458. 'text' => esc_attr__( 'False', 'custom-post-type-ui' ),  
  459. 'default' => 'true' 
  460. ),  
  461. array( 'attr' => '1', 'text' => esc_attr__( 'True', 'custom-post-type-ui' ) ),  
  462. ),  
  463. ); 
  464. $selected = ( isset( $current ) ) ? disp_boolean( $current['hierarchical'] ) : ''; 
  465. $select['selected'] = ( ! empty( $selected ) ) ? $current['hierarchical'] : ''; 
  466. echo $ui->get_select_input( array( 
  467. 'namearray' => 'cpt_custom_tax',  
  468. 'name' => 'hierarchical',  
  469. 'labeltext' => esc_html__( 'Hierarchical', 'custom-post-type-ui' ),  
  470. 'aftertext' => esc_html__( '(default: false) Whether the taxonomy can have parent-child relationships.', 'custom-post-type-ui' ),  
  471. 'selections' => $select,  
  472. ) ); 
  473.  
  474. $select = array( 
  475. 'options' => array( 
  476. array( 'attr' => '0', 'text' => esc_attr__( 'False', 'custom-post-type-ui' ) ),  
  477. array( 
  478. 'attr' => '1',  
  479. 'text' => esc_attr__( 'True', 'custom-post-type-ui' ),  
  480. 'default' => 'true' 
  481. ),  
  482. ),  
  483. ); 
  484. $selected = ( isset( $current ) ) ? disp_boolean( $current['show_ui'] ) : ''; 
  485. $select['selected'] = ( ! empty( $selected ) ) ? $current['show_ui'] : ''; 
  486. echo $ui->get_select_input( array( 
  487. 'namearray' => 'cpt_custom_tax',  
  488. 'name' => 'show_ui',  
  489. 'labeltext' => esc_html__( 'Show UI', 'custom-post-type-ui' ),  
  490. 'aftertext' => esc_html__( '(default: true) Whether to generate a default UI for managing this custom taxonomy.', 'custom-post-type-ui' ),  
  491. 'selections' => $select,  
  492. ) ); 
  493.  
  494. $select = array( 
  495. 'options' => array( 
  496. array( 'attr' => '0', 'text' => esc_attr__( 'False', 'custom-post-type-ui' ) ),  
  497. array( 
  498. 'attr' => '1',  
  499. 'text' => esc_attr__( 'True', 'custom-post-type-ui' ),  
  500. 'default' => 'true' 
  501. ),  
  502. ),  
  503. ); 
  504. $selected = ( isset( $current ) ) ? disp_boolean( $current['show_in_menu'] ) : ''; 
  505. $select['selected'] = ( ! empty( $selected ) ) ? $current['show_in_menu'] : ''; 
  506. echo $ui->get_select_input( array( 
  507. 'namearray' => 'cpt_custom_tax',  
  508. 'name' => 'show_in_menu',  
  509. 'labeltext' => esc_html__( 'Show in menu', 'custom-post-type-ui' ),  
  510. 'aftertext' => esc_html__( '(default: value of show_ui) Whether to show the taxonomy in the admin menu.', 'custom-post-type-ui' ),  
  511. 'selections' => $select,  
  512. ) ); 
  513.  
  514. $select = array( 
  515. 'options' => array( 
  516. array( 'attr' => '0', 'text' => esc_attr__( 'False', 'custom-post-type-ui' ) ),  
  517. array( 
  518. 'attr' => '1',  
  519. 'text' => esc_attr__( 'True', 'custom-post-type-ui' ),  
  520. 'default' => 'true' 
  521. ),  
  522. ),  
  523. ); 
  524. $selected = ( isset( $current ) && ! empty( $current['show_in_nav_menus'] ) ) ? disp_boolean( $current['show_in_nav_menus'] ) : ''; 
  525. $select['selected'] = ( ! empty( $selected ) ) ? $current['show_in_nav_menus'] : ''; 
  526. echo $ui->get_select_input( array( 
  527. 'namearray' => 'cpt_custom_tax',  
  528. 'name' => 'show_in_nav_menus',  
  529. 'labeltext' => esc_html__( 'Show in nav menus', 'custom-post-type-ui' ),  
  530. 'aftertext' => esc_html__( '(default: value of public) Whether to make the taxonomy available for selection in navigation menus.', 'custom-post-type-ui' ),  
  531. 'selections' => $select,  
  532. ) ); 
  533.  
  534. $select = array( 
  535. 'options' => array( 
  536. array( 'attr' => '0', 'text' => esc_attr__( 'False', 'custom-post-type-ui' ) ),  
  537. array( 
  538. 'attr' => '1',  
  539. 'text' => esc_attr__( 'True', 'custom-post-type-ui' ),  
  540. 'default' => 'true' 
  541. ),  
  542. ),  
  543. ); 
  544. $selected = ( isset( $current ) ) ? disp_boolean( $current['query_var'] ) : ''; 
  545. $select['selected'] = ( ! empty( $selected ) ) ? $current['query_var'] : ''; 
  546. echo $ui->get_select_input( array( 
  547. 'namearray' => 'cpt_custom_tax',  
  548. 'name' => 'query_var',  
  549. 'labeltext' => esc_html__( 'Query Var', 'custom-post-type-ui' ),  
  550. 'aftertext' => esc_html__( '(default: true) Sets the query_var key for this taxonomy.', 'custom-post-type-ui' ),  
  551. 'selections' => $select,  
  552. ) ); 
  553.  
  554. echo $ui->get_text_input( array( 
  555. 'namearray' => 'cpt_custom_tax',  
  556. 'name' => 'query_var_slug',  
  557. 'textvalue' => ( isset( $current['query_var_slug'] ) ) ? esc_attr( $current['query_var_slug'] ) : '',  
  558. 'aftertext' => esc_attr__( '(default: taxonomy slug). Query var needs to be true to use.', 'custom-post-type-ui' ),  
  559. 'labeltext' => esc_html__( 'Custom Query Var String', 'custom-post-type-ui' ),  
  560. 'helptext' => esc_html__( 'Sets a custom query_var slug for this taxonomy.', 'custom-post-type-ui' ),  
  561. ) ); 
  562.  
  563. $select = array( 
  564. 'options' => array( 
  565. array( 'attr' => '0', 'text' => esc_attr__( 'False', 'custom-post-type-ui' ) ),  
  566. array( 
  567. 'attr' => '1',  
  568. 'text' => esc_attr__( 'True', 'custom-post-type-ui' ),  
  569. 'default' => 'true' 
  570. ),  
  571. ),  
  572. ); 
  573. $selected = ( isset( $current ) ) ? disp_boolean( $current['rewrite'] ) : ''; 
  574. $select['selected'] = ( ! empty( $selected ) ) ? $current['rewrite'] : ''; 
  575. echo $ui->get_select_input( array( 
  576. 'namearray' => 'cpt_custom_tax',  
  577. 'name' => 'rewrite',  
  578. 'labeltext' => esc_html__( 'Rewrite', 'custom-post-type-ui' ),  
  579. 'aftertext' => esc_html__( '(default: true) Whether or not WordPress should use rewrites for this taxonomy.', 'custom-post-type-ui' ),  
  580. 'selections' => $select,  
  581. ) ); 
  582.  
  583. echo $ui->get_text_input( array( 
  584. 'namearray' => 'cpt_custom_tax',  
  585. 'name' => 'rewrite_slug',  
  586. 'textvalue' => ( isset( $current['rewrite_slug'] ) ) ? esc_attr( $current['rewrite_slug'] ) : '',  
  587. 'aftertext' => esc_attr__( '(default: taxonomy name)', 'custom-post-type-ui' ),  
  588. 'labeltext' => esc_html__( 'Custom Rewrite Slug', 'custom-post-type-ui' ),  
  589. 'helptext' => esc_html__( 'Custom taxonomy rewrite slug.', 'custom-post-type-ui' ),  
  590. ) ); 
  591.  
  592. $select = array( 
  593. 'options' => array( 
  594. array( 'attr' => '0', 'text' => esc_attr__( 'False', 'custom-post-type-ui' ) ),  
  595. array( 
  596. 'attr' => '1',  
  597. 'text' => esc_attr__( 'True', 'custom-post-type-ui' ),  
  598. 'default' => 'true' 
  599. ),  
  600. ),  
  601. ); 
  602. $selected = ( isset( $current ) ) ? disp_boolean( $current['rewrite_withfront'] ) : ''; 
  603. $select['selected'] = ( ! empty( $selected ) ) ? $current['rewrite_withfront'] : ''; 
  604. echo $ui->get_select_input( array( 
  605. 'namearray' => 'cpt_custom_tax',  
  606. 'name' => 'rewrite_withfront',  
  607. 'labeltext' => esc_html__( 'Rewrite With Front', 'custom-post-type-ui' ),  
  608. 'aftertext' => esc_html__( '(default: true) Should the permastruct be prepended with the front base.', 'custom-post-type-ui' ),  
  609. 'selections' => $select,  
  610. ) ); 
  611.  
  612. $select = array( 
  613. 'options' => array( 
  614. array( 
  615. 'attr' => '0',  
  616. 'text' => esc_attr__( 'False', 'custom-post-type-ui' ),  
  617. 'default' => 'false' 
  618. ),  
  619. array( 'attr' => '1', 'text' => esc_attr__( 'True', 'custom-post-type-ui' ) ),  
  620. ),  
  621. ); 
  622. $selected = ( isset( $current ) ) ? disp_boolean( $current['rewrite_hierarchical'] ) : ''; 
  623. $select['selected'] = ( ! empty( $selected ) ) ? $current['rewrite_hierarchical'] : ''; 
  624. echo $ui->get_select_input( array( 
  625. 'namearray' => 'cpt_custom_tax',  
  626. 'name' => 'rewrite_hierarchical',  
  627. 'labeltext' => esc_html__( 'Rewrite Hierarchical', 'custom-post-type-ui' ),  
  628. 'aftertext' => esc_html__( '(default: false) Should the permastruct allow hierarchical urls.', 'custom-post-type-ui' ),  
  629. 'selections' => $select,  
  630. ) ); 
  631.  
  632. $select = array( 
  633. 'options' => array( 
  634. array( 
  635. 'attr' => '0',  
  636. 'text' => esc_attr__( 'False', 'custom-post-type-ui' ),  
  637. 'default' => 'true' 
  638. ),  
  639. array( 'attr' => '1', 'text' => esc_attr__( 'True', 'custom-post-type-ui' ) ),  
  640. ),  
  641. ); 
  642. $selected = ( isset( $current ) ) ? disp_boolean( $current['show_admin_column'] ) : ''; 
  643. $select['selected'] = ( ! empty( $selected ) ) ? $current['show_admin_column'] : ''; 
  644. echo $ui->get_select_input( array( 
  645. 'namearray' => 'cpt_custom_tax',  
  646. 'name' => 'show_admin_column',  
  647. 'labeltext' => esc_html__( 'Show Admin Column', 'custom-post-type-ui' ),  
  648. 'aftertext' => esc_html__( '(default: false) Whether to allow automatic creation of taxonomy columns on associated post-types.', 'custom-post-type-ui' ),  
  649. 'selections' => $select,  
  650. ) ); 
  651.  
  652. $select = array( 
  653. 'options' => array( 
  654. array( 
  655. 'attr' => '0',  
  656. 'text' => esc_attr__( 'False', 'custom-post-type-ui' ),  
  657. 'default' => 'false' 
  658. ),  
  659. array( 'attr' => '1', 'text' => esc_attr__( 'True', 'custom-post-type-ui' ) ),  
  660. ),  
  661. ); 
  662. $selected = ( isset( $current ) ) ? disp_boolean( $current['show_in_rest'] ) : ''; 
  663. $select['selected'] = ( ! empty( $selected ) ) ? $current['show_in_rest'] : ''; 
  664. echo $ui->get_select_input( array( 
  665. 'namearray' => 'cpt_custom_tax',  
  666. 'name' => 'show_in_rest',  
  667. 'labeltext' => esc_html__( 'Show in REST API', 'custom-post-type-ui' ),  
  668. 'aftertext' => esc_html__( '(default: false) Whether to show this taxonomy data in the WP REST API.', 'custom-post-type-ui' ),  
  669. 'selections' => $select,  
  670. ) ); 
  671.  
  672. echo $ui->get_text_input( array( 
  673. 'namearray' => 'cpt_custom_tax',  
  674. 'name' => 'rest_base',  
  675. 'labeltext' => esc_html__( 'REST API base slug', 'custom-post-type-ui' ),  
  676. 'helptext' => esc_attr__( 'Slug to use in REST API URLs.', 'custom-post-type-ui' ),  
  677. 'textvalue' => ( isset( $current['rest_base'] ) ) ? esc_attr( $current['rest_base'] ) : '',  
  678. ) ); 
  679.  
  680. $select = array( 
  681. 'options' => array( 
  682. array( 
  683. 'attr' => '0',  
  684. 'text' => esc_attr__( 'False', 'custom-post-type-ui' ),  
  685. 'default' => 'false' 
  686. ),  
  687. array( 'attr' => '1', 'text' => esc_attr__( 'True', 'custom-post-type-ui' ) ),  
  688. ),  
  689. ); 
  690. $selected = ( isset( $current ) && ! empty( $current['show_in_quick_edit'] ) ) ? disp_boolean( $current['show_in_quick_edit'] ) : ''; 
  691. $select['selected'] = ( ! empty( $selected ) ) ? $current['show_in_quick_edit'] : ''; 
  692. echo $ui->get_select_input( array( 
  693. 'namearray' => 'cpt_custom_tax',  
  694. 'name' => 'show_in_quick_edit',  
  695. 'labeltext' => esc_html__( 'Show in quick/bulk edit panel.', 'custom-post-type-ui' ),  
  696. 'aftertext' => esc_html__( '(default: false) Whether to show the taxonomy in the quick/bulk edit panel.', 'custom-post-type-ui' ),  
  697. 'selections' => $select,  
  698. ) ); 
  699. ?> 
  700. </table> 
  701. </div> 
  702. </div> 
  703. </div> 
  704.  
  705. <?php 
  706. /** 
  707. * Fires after the default fieldsets on the taxonomy screen. 
  708. * @since 1.3.0 
  709. * @param cptui_admin_ui $ui Admin UI instance. 
  710. */ 
  711. do_action( 'cptui_taxonomy_after_fieldsets', $ui ); ?> 
  712.  
  713. <p class="submit"> 
  714. <?php wp_nonce_field( 'cptui_addedit_taxonomy_nonce_action', 'cptui_addedit_taxonomy_nonce_field' ); 
  715. if ( ! empty( $_GET ) && ! empty( $_GET['action'] ) && 'edit' == $_GET['action'] ) { ?> 
  716. <?php 
  717.  
  718. /** 
  719. * Filters the text value to use on the button when editing. 
  720. * @since 1.0.0 
  721. * @param string $value Text to use for the button. 
  722. */ 
  723. ?> 
  724. <input type="submit" class="button-primary cptui-taxonomy-submit" name="cpt_submit" value="<?php echo esc_attr( apply_filters( 'cptui_taxonomy_submit_edit', esc_attr__( 'Save Taxonomy', 'custom-post-type-ui' ) ) ); ?>" /> 
  725. <?php 
  726.  
  727. /** 
  728. * Filters the text value to use on the button when deleting. 
  729. * @since 1.0.0 
  730. * @param string $value Text to use for the button. 
  731. */ 
  732. ?> 
  733. <input type="submit" class="button-secondary" name="cpt_delete" id="cpt_submit_delete" value="<?php echo esc_attr( apply_filters( 'cptui_taxonomy_submit_delete', __( 'Delete Taxonomy', 'custom-post-type-ui' ) ) ); ?>" /> 
  734. <?php } else { ?> 
  735. <?php 
  736.  
  737. /** 
  738. * Filters the text value to use on the button when adding. 
  739. * @since 1.0.0 
  740. * @param string $value Text to use for the button. 
  741. */ 
  742. ?> 
  743. <input type="submit" class="button-primary" name="cpt_submit" value="<?php echo esc_attr( apply_filters( 'cptui_taxonomy_submit_add', esc_attr__( 'Add Taxonomy', 'custom-post-type-ui' ) ) ); ?>" /> 
  744. <?php } ?> 
  745.  
  746. <?php if ( ! empty( $current ) ) { ?> 
  747. <input type="hidden" name="tax_original" id="tax_original" value="<?php echo $current['name']; ?>" /> 
  748. <?php } 
  749.  
  750. // Used to check and see if we should prevent duplicate slugs. ?> 
  751. <input type="hidden" name="cpt_tax_status" id="cpt_tax_status" value="<?php echo $tab; ?>" /> 
  752. </p> 
  753. </div> 
  754. </div> 
  755. </form> 
  756. </div><!-- End .wrap --> 
  757. <?php