cptui_manage_post_types

Create our settings page output.

Description

cptui_manage_post_types(); 

Usage

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

Defined (1)

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

/inc/post-types.php  
  1. function cptui_manage_post_types() { 
  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 post type editor screen. 
  11. * @since 1.3.0 
  12. */ 
  13.  
  14. /** 
  15. * Filters whether or not a post type was deleted. 
  16. * @since 1.4.0 
  17. * @param bool $value Whether or not post type deleted. Default false. 
  18. */ 
  19. $post_type_deleted = apply_filters( 'cptui_post_type_deleted', false ); 
  20.  
  21.  
  22. /** 
  23. * Fires below the output for the tab menu on the post type add/edit screen. 
  24. * @since 1.3.0 
  25. */ 
  26.  
  27. if ( 'edit' == $tab ) { 
  28.  
  29. $post_types = cptui_get_post_type_data(); 
  30.  
  31. $selected_post_type = cptui_get_current_post_type( $post_type_deleted ); 
  32.  
  33. if ( $selected_post_type ) { 
  34. if ( array_key_exists( $selected_post_type, $post_types ) ) { 
  35. $current = $post_types[ $selected_post_type ]; 
  36.  
  37. $ui = new cptui_admin_ui(); 
  38.  
  39. // Will only be set if we're already on the edit screen. 
  40. if ( ! empty( $post_types ) ) { ?> 
  41. <form id="cptui_select_post_type" method="post" action="<?php echo esc_url( cptui_get_post_form_action( $ui ) ); ?>"> 
  42. <label for="post_type"><?php esc_html_e( 'Select: ', 'custom-post-type-ui' ); ?></label> 
  43. <?php 
  44. cptui_post_types_dropdown( $post_types ); 
  45.  
  46. /** 
  47. * Filters the text value to use on the select post type button. 
  48. * @since 1.0.0 
  49. * @param string $value Text to use for the button. 
  50. */ 
  51. ?> 
  52. <input type="submit" class="button-secondary" name="cptui_select_post_type_submit" value="<?php echo esc_attr( apply_filters( 'cptui_post_type_submit_select', __( 'Select', 'custom-post-type-ui' ) ) ); ?>" /> 
  53. </form> 
  54. <?php 
  55.  
  56. /** 
  57. * Fires below the post type select input. 
  58. * @since 1.1.0 
  59. * @param string $value Current post type selected. 
  60. */ 
  61. do_action( 'cptui_below_post_type_select', $current['name'] ); 
  62. } ?> 
  63.  
  64. <form class="posttypesui" method="post" action="<?php echo esc_url( cptui_get_post_form_action( $ui ) ); ?>"> 
  65. <div class="postbox-container"> 
  66. <div id="poststuff"> 
  67. <div class="cptui-section postbox"> 
  68. <button type="button" class="handlediv button-link" aria-expanded="true"> 
  69. <span class="screen-reader-text"><?php esc_html_e( 'Toggle panel: Basic settings', 'custom-post-type-ui' ); ?></span> 
  70. <span class="toggle-indicator" aria-hidden="true"></span> 
  71. </button> 
  72. <h2 class="hndle"> 
  73. <span><?php esc_html_e( 'Basic settings', 'custom-post-type-ui' ); ?></span> 
  74. </h2> 
  75. <div class="inside"> 
  76. <div class="main"> 
  77. <table class="form-table cptui-table"> 
  78. <?php 
  79. echo $ui->get_tr_start() . $ui->get_th_start(); 
  80. echo $ui->get_label( 'name', esc_html__( 'Post Type Slug', 'custom-post-type-ui' ) ); 
  81. echo $ui->get_required_span(); 
  82.  
  83. if ( 'edit' == $tab ) { 
  84. echo '<p id="slugchanged" class="hidemessage">' . esc_html__( 'Slug has changed', 'custom_post_type_ui' ) . '</p>'; 
  85.  
  86. echo $ui->get_th_end() . $ui->get_td_start(); 
  87.  
  88. echo $ui->get_text_input( array( 
  89. 'namearray' => 'cpt_custom_post_type',  
  90. 'name' => 'name',  
  91. 'textvalue' => ( isset( $current['name'] ) ) ? esc_attr( $current['name'] ) : '',  
  92. 'maxlength' => '20',  
  93. 'helptext' => esc_html__( 'The post type name/slug. Used for various queries for post type content.', 'custom-post-type-ui' ),  
  94. 'required' => true,  
  95. 'placeholder' => false,  
  96. 'wrap' => false,  
  97. ) ); 
  98. echo '<p class="cptui-slug-details">'; 
  99. 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' ); 
  100. echo '</p>'; 
  101.  
  102. if ( 'edit' == $tab ) { 
  103. echo '<p>'; 
  104. esc_html_e( 'DO NOT EDIT the post type slug unless also planning to migrate posts. Changing the slug registers a new post type entry.', 'custom-post-type-ui' ); 
  105. echo '</p>'; 
  106.  
  107. echo '<div class="cptui-spacer">'; 
  108. echo $ui->get_check_input( array( 
  109. 'checkvalue' => 'update_post_types',  
  110. 'checked' => 'false',  
  111. 'name' => 'update_post_types',  
  112. 'namearray' => 'update_post_types',  
  113. 'labeltext' => esc_html__( 'Migrate posts to newly renamed post type?', 'custom-post-type-ui' ),  
  114. 'helptext' => false,  
  115. 'default' => false,  
  116. 'wrap' => false,  
  117. ) ); 
  118. echo '</div>'; 
  119.  
  120. echo $ui->get_td_end(); echo $ui->get_tr_end(); 
  121.  
  122. echo $ui->get_text_input( array( 
  123. 'namearray' => 'cpt_custom_post_type',  
  124. 'name' => 'label',  
  125. 'textvalue' => ( isset( $current['label'] ) ) ? esc_attr( $current['label'] ) : '',  
  126. 'labeltext' => esc_html__( 'Plural Label', 'custom-post-type-ui' ),  
  127. 'aftertext' => esc_html__( '(e.g. Movies)', 'custom-post-type-ui' ),  
  128. 'helptext' => esc_html__( 'Used for the post type admin menu item.', 'custom-post-type-ui' ),  
  129. 'required' => true,  
  130. ) ); 
  131.  
  132. echo $ui->get_text_input( array( 
  133. 'namearray' => 'cpt_custom_post_type',  
  134. 'name' => 'singular_label',  
  135. 'textvalue' => ( isset( $current['singular_label'] ) ) ? esc_attr( $current['singular_label'] ) : '',  
  136. 'labeltext' => esc_html__( 'Singular Label', 'custom-post-type-ui' ),  
  137. 'aftertext' => esc_html__( '(e.g. Movie)', 'custom-post-type-ui' ),  
  138. 'helptext' => esc_html__( 'Used when a singular label is needed.', 'custom-post-type-ui' ),  
  139. 'required' => true,  
  140. ) ); 
  141. ?> 
  142. </table> 
  143. <p class="submit"> 
  144. <?php wp_nonce_field( 'cptui_addedit_post_type_nonce_action', 'cptui_addedit_post_type_nonce_field' ); 
  145. if ( ! empty( $_GET ) && ! empty( $_GET['action'] ) && 'edit' == $_GET['action'] ) { ?> 
  146. <?php 
  147.  
  148. /** 
  149. * Filters the text value to use on the button when editing. 
  150. * @since 1.0.0 
  151. * @param string $value Text to use for the button. 
  152. */ 
  153. ?> 
  154. <input type="submit" class="button-primary" name="cpt_submit" value="<?php echo esc_attr( apply_filters( 'cptui_post_type_submit_edit', __( 'Save Post Type', 'custom-post-type-ui' ) ) ); ?>" /> 
  155. <?php 
  156.  
  157. /** 
  158. * Filters the text value to use on the button when deleting. 
  159. * @since 1.0.0 
  160. * @param string $value Text to use for the button. 
  161. */ 
  162. ?> 
  163. <input type="submit" class="button-secondary" name="cpt_delete" id="cpt_submit_delete" value="<?php echo esc_attr( apply_filters( 'cptui_post_type_submit_delete', __( 'Delete Post Type', 'custom-post-type-ui' ) ) ); ?>" /> 
  164. <?php } else { ?> 
  165. <?php 
  166.  
  167. /** 
  168. * Filters the text value to use on the button when adding. 
  169. * @since 1.0.0 
  170. * @param string $value Text to use for the button. 
  171. */ 
  172. ?> 
  173. <input type="submit" class="button-primary" name="cpt_submit" value="<?php echo esc_attr( apply_filters( 'cptui_post_type_submit_add', __( 'Add Post Type', 'custom-post-type-ui' ) ) ); ?>" /> 
  174. <?php } 
  175.  
  176. if ( ! empty( $current ) ) { ?> 
  177. <input type="hidden" name="cpt_original" id="cpt_original" value="<?php esc_attr_e( $current['name'] ); ?>" /> 
  178. <?php } 
  179.  
  180. // Used to check and see if we should prevent duplicate slugs. ?> 
  181. <input type="hidden" name="cpt_type_status" id="cpt_type_status" value="<?php esc_attr_e( $tab ); ?>" /> 
  182. </p> 
  183. </div> 
  184. </div> 
  185. </div> 
  186. <div class="cptui-section postbox"> 
  187. <button type="button" class="handlediv button-link" aria-expanded="true"> 
  188. <span class="screen-reader-text"><?php esc_html_e( 'Toggle panel: Additional labels', 'custom-post-type-ui' ); ?></span> 
  189. <span class="toggle-indicator" aria-hidden="true"></span> 
  190. </button> 
  191. <h2 class="hndle"> 
  192. <span><?php esc_html_e( 'Additional labels', 'custom-post-type-ui' ); ?></span> 
  193. </h2> 
  194. <div class="inside"> 
  195. <div class="main"> 
  196. <table class="form-table cptui-table"> 
  197. <?php 
  198.  
  199. if ( isset( $current['description'] ) ) { 
  200. $current['description'] = stripslashes_deep( $current['description'] ); 
  201. echo $ui->get_textarea_input( array( 
  202. 'namearray' => 'cpt_custom_post_type',  
  203. 'name' => 'description',  
  204. 'rows' => '4',  
  205. 'cols' => '40',  
  206. 'textvalue' => ( isset( $current['description'] ) ) ? esc_textarea( $current['description'] ) : '',  
  207. 'labeltext' => esc_html__( 'Post Type Description', 'custom-post-type-ui' ),  
  208. 'helptext' => esc_html__( 'Perhaps describe what your custom post type is used for?', 'custom-post-type-ui' ),  
  209. ) ); 
  210.  
  211. echo $ui->get_text_input( array( 
  212. 'labeltext' => esc_html__( 'Menu Name', 'custom-post-type-ui' ),  
  213. 'helptext' => esc_html__( 'Custom admin menu name for your custom post type.', 'custom-post-type-ui' ),  
  214. 'namearray' => 'cpt_labels',  
  215. 'name' => 'menu_name',  
  216. 'textvalue' => ( isset( $current['labels']['menu_name'] ) ) ? esc_attr( $current['labels']['menu_name'] ) : '',  
  217. 'aftertext' => esc_html__( '(e.g. My Movies)', 'custom-post-type-ui' ),  
  218. ) ); 
  219.  
  220. echo $ui->get_text_input( array( 
  221. 'labeltext' => esc_html__( 'All Items', 'custom-post-type-ui' ),  
  222. 'helptext' => esc_html__( 'Used in the post type admin submenu.', 'custom-post-type-ui' ),  
  223. 'namearray' => 'cpt_labels',  
  224. 'name' => 'all_items',  
  225. 'textvalue' => ( isset( $current['labels']['all_items'] ) ) ? esc_attr( $current['labels']['all_items'] ) : '',  
  226. 'aftertext' => esc_html__( '(e.g. All Movies)', 'custom-post-type-ui' ),  
  227. ) ); 
  228.  
  229. echo $ui->get_text_input( array( 
  230. 'labeltext' => esc_html__( 'Add New', 'custom-post-type-ui' ),  
  231. 'helptext' => esc_html__( 'Used in the post type admin submenu.', 'custom-post-type-ui' ),  
  232. 'namearray' => 'cpt_labels',  
  233. 'name' => 'add_new',  
  234. 'textvalue' => ( isset( $current['labels']['add_new'] ) ) ? esc_attr( $current['labels']['add_new'] ) : '',  
  235. 'aftertext' => esc_html__( '(e.g. Add New)', 'custom-post-type-ui' ),  
  236. ) ); 
  237.  
  238. echo $ui->get_text_input( array( 
  239. 'labeltext' => esc_html__( 'Add New Item', 'custom-post-type-ui' ),  
  240. 'helptext' => esc_html__( 'Used at the top of the post editor screen for a new post type post.', 'custom-post-type-ui' ),  
  241. 'namearray' => 'cpt_labels',  
  242. 'name' => 'add_new_item',  
  243. 'textvalue' => ( isset( $current['labels']['add_new_item'] ) ) ? esc_attr( $current['labels']['add_new_item'] ) : '',  
  244. 'aftertext' => esc_html__( '(e.g. Add New Movie)', 'custom-post-type-ui' ),  
  245. ) ); 
  246.  
  247. echo $ui->get_text_input( array( 
  248. 'labeltext' => esc_html__( 'Edit Item', 'custom-post-type-ui' ),  
  249. 'helptext' => esc_html__( 'Used at the top of the post editor screen for an existing post type post.', 'custom-post-type-ui' ),  
  250. 'namearray' => 'cpt_labels',  
  251. 'name' => 'edit_item',  
  252. 'textvalue' => ( isset( $current['labels']['edit_item'] ) ) ? esc_attr( $current['labels']['edit_item'] ) : '',  
  253. 'aftertext' => esc_html__( '(e.g. Edit Movie)', 'custom-post-type-ui' ),  
  254. ) ); 
  255.  
  256. echo $ui->get_text_input( array( 
  257. 'labeltext' => esc_html__( 'New Item', 'custom-post-type-ui' ),  
  258. 'helptext' => esc_html__( 'Post type label. Used in the admin menu for displaying post types.', 'custom-post-type-ui' ),  
  259. 'namearray' => 'cpt_labels',  
  260. 'name' => 'new_item',  
  261. 'textvalue' => ( isset( $current['labels']['new_item'] ) ) ? esc_attr( $current['labels']['new_item'] ) : '',  
  262. 'aftertext' => esc_html__( '(e.g. New Movie)', 'custom-post-type-ui' ),  
  263. ) ); 
  264.  
  265. echo $ui->get_text_input( array( 
  266. 'labeltext' => esc_html__( 'View Item', 'custom-post-type-ui' ),  
  267. 'helptext' => esc_html__( 'Used in the admin bar when viewing editor screen for a published post in the post type.', 'custom-post-type-ui' ),  
  268. 'namearray' => 'cpt_labels',  
  269. 'name' => 'view_item',  
  270. 'textvalue' => ( isset( $current['labels']['view_item'] ) ) ? esc_attr( $current['labels']['view_item'] ) : '',  
  271. 'aftertext' => esc_html__( '(e.g. View Movie)', 'custom-post-type-ui' ),  
  272. ) ); 
  273.  
  274. echo $ui->get_text_input( array( 
  275. 'labeltext' => esc_html__( 'View Items', 'custom-post-type-ui' ),  
  276. 'helptext' => esc_html__( 'Used in the admin bar when viewing editor screen for a published post in the post type.', 'custom-post-type-ui' ),  
  277. 'namearray' => 'cpt_labels',  
  278. 'name' => 'view_items',  
  279. 'textvalue' => ( isset( $current['labels']['view_items'] ) ) ? esc_attr( $current['labels']['view_items'] ) : '',  
  280. 'aftertext' => esc_html__( '(e.g. View Movies)', 'custom-post-type-ui' ),  
  281. ) ); 
  282.  
  283. echo $ui->get_text_input( array( 
  284. 'labeltext' => esc_html__( 'Search Item', 'custom-post-type-ui' ),  
  285. 'helptext' => esc_html__( 'Used as the text for the search button on post type list screen.', 'custom-post-type-ui' ),  
  286. 'namearray' => 'cpt_labels',  
  287. 'name' => 'search_items',  
  288. 'textvalue' => ( isset( $current['labels']['search_items'] ) ) ? esc_attr( $current['labels']['search_items'] ) : '',  
  289. 'aftertext' => esc_html__( '(e.g. Search Movie)', 'custom-post-type-ui' ),  
  290. ) ); 
  291.  
  292. echo $ui->get_text_input( array( 
  293. 'labeltext' => esc_html__( 'Not Found', 'custom-post-type-ui' ),  
  294. 'helptext' => esc_html__( 'Used when there are no posts to display on the post type list screen.', 'custom-post-type-ui' ),  
  295. 'namearray' => 'cpt_labels',  
  296. 'name' => 'not_found',  
  297. 'textvalue' => ( isset( $current['labels']['not_found'] ) ) ? esc_attr( $current['labels']['not_found'] ) : '',  
  298. 'aftertext' => esc_html__( '(e.g. No Movies found)', 'custom-post-type-ui' ),  
  299. ) ); 
  300.  
  301. echo $ui->get_text_input( array( 
  302. 'labeltext' => esc_html__( 'Not Found in Trash', 'custom-post-type-ui' ),  
  303. 'helptext' => esc_html__( 'Used when there are no posts to display on the post type list trash screen.', 'custom-post-type-ui' ),  
  304. 'namearray' => 'cpt_labels',  
  305. 'name' => 'not_found_in_trash',  
  306. 'textvalue' => ( isset( $current['labels']['not_found_in_trash'] ) ) ? esc_attr( $current['labels']['not_found_in_trash'] ) : '',  
  307. 'aftertext' => esc_html__( '(e.g. No Movies found in Trash)', 'custom-post-type-ui' ),  
  308. ) ); 
  309.  
  310. // As of 1.4.0, this will register into `parent_item_colon` paramter upon registration and export. 
  311. echo $ui->get_text_input( array( 
  312. 'labeltext' => esc_html__( 'Parent', 'custom-post-type-ui' ),  
  313. 'helptext' => esc_html__( 'Used for hierarchical types that need a colon.', 'custom-post-type-ui' ),  
  314. 'namearray' => 'cpt_labels',  
  315. 'name' => 'parent',  
  316. 'textvalue' => ( isset( $current['labels']['parent'] ) ) ? esc_attr( $current['labels']['parent'] ) : '',  
  317. 'aftertext' => esc_html__( '(e.g. Parent Movie:)', 'custom-post-type-ui' ),  
  318. ) ); 
  319.  
  320. echo $ui->get_text_input( array( 
  321. 'labeltext' => esc_html__( 'Featured Image', 'custom-post-type-ui' ),  
  322. 'helptext' => esc_html__( 'Used as the "Featured Image" phrase for the post type.', 'custom-post-type-ui' ),  
  323. 'namearray' => 'cpt_labels',  
  324. 'name' => 'featured_image',  
  325. 'textvalue' => ( isset( $current['labels']['featured_image'] ) ) ? esc_attr( $current['labels']['featured_image'] ) : '',  
  326. 'aftertext' => esc_html__( '(e.g. Featured image for this movie)', 'custom-post-type-ui' ),  
  327. ) ); 
  328.  
  329. echo $ui->get_text_input( array( 
  330. 'labeltext' => esc_html__( 'Set Featured Image', 'custom-post-type-ui' ),  
  331. 'helptext' => esc_html__( 'Used as the "Set featured image" phrase for the post type.', 'custom-post-type-ui' ),  
  332. 'namearray' => 'cpt_labels',  
  333. 'name' => 'set_featured_image',  
  334. 'textvalue' => ( isset( $current['labels']['set_featured_image'] ) ) ? esc_attr( $current['labels']['set_featured_image'] ) : '',  
  335. 'aftertext' => esc_html__( '(e.g. Set featured image for this movie)', 'custom-post-type-ui' ),  
  336. ) ); 
  337.  
  338. echo $ui->get_text_input( array( 
  339. 'labeltext' => esc_html__( 'Remove Featured Image', 'custom-post-type-ui' ),  
  340. 'helptext' => esc_html__( 'Used as the "Remove featured image" phrase for the post type.', 'custom-post-type-ui' ),  
  341. 'namearray' => 'cpt_labels',  
  342. 'name' => 'remove_featured_image',  
  343. 'textvalue' => ( isset( $current['labels']['remove_featured_image'] ) ) ? esc_attr( $current['labels']['remove_featured_image'] ) : '',  
  344. 'aftertext' => esc_html__( '(e.g. Remove featured image for this movie)', 'custom-post-type-ui' ),  
  345. ) ); 
  346.  
  347. echo $ui->get_text_input( array( 
  348. 'labeltext' => esc_html__( 'Use Featured Image', 'custom-post-type-ui' ),  
  349. 'helptext' => esc_html__( 'Used as the "Use as featured image" phrase for the post type.', 'custom-post-type-ui' ),  
  350. 'namearray' => 'cpt_labels',  
  351. 'name' => 'use_featured_image',  
  352. 'textvalue' => ( isset( $current['labels']['use_featured_image'] ) ) ? esc_attr( $current['labels']['use_featured_image'] ) : '',  
  353. 'aftertext' => esc_html__( '(e.g. Use as featured image for this movie)', 'custom-post-type-ui' ),  
  354. ) ); 
  355.  
  356. echo $ui->get_text_input( array( 
  357. 'labeltext' => esc_html__( 'Archives', 'custom-post-type-ui' ),  
  358. 'helptext' => esc_html__( 'Post type archive label used in nav menus.', 'custom-post-type-ui' ),  
  359. 'namearray' => 'cpt_labels',  
  360. 'name' => 'archives',  
  361. 'textvalue' => ( isset( $current['labels']['archives'] ) ) ? esc_attr( $current['labels']['archives'] ) : '',  
  362. 'aftertext' => esc_html__( '(e.g. Movie archives)', 'custom-post-type-ui' ),  
  363. ) ); 
  364.  
  365. echo $ui->get_text_input( array( 
  366. 'labeltext' => esc_html__( 'Insert into item', 'custom-post-type-ui' ),  
  367. 'helptext' => esc_html__( 'Used as the "Insert into post" or "Insert into page" phrase for the post type.', 'custom-post-type-ui' ),  
  368. 'namearray' => 'cpt_labels',  
  369. 'name' => 'insert_into_item',  
  370. 'textvalue' => ( isset( $current['labels']['insert_into_item'] ) ) ? esc_attr( $current['labels']['insert_into_item'] ) : '',  
  371. 'aftertext' => esc_html__( '(e.g. Insert into movie)', 'custom-post-type-ui' ),  
  372. ) ); 
  373.  
  374. echo $ui->get_text_input( array( 
  375. 'labeltext' => esc_html__( 'Uploaded to this Item', 'custom-post-type-ui' ),  
  376. 'helptext' => esc_html__( 'Used as the "Uploaded to this post" or "Uploaded to this page" phrase for the post type.', 'custom-post-type-ui' ),  
  377. 'namearray' => 'cpt_labels',  
  378. 'name' => 'uploaded_to_this_item',  
  379. 'textvalue' => ( isset( $current['labels']['uploaded_to_this_item'] ) ) ? esc_attr( $current['labels']['uploaded_to_this_item'] ) : '',  
  380. 'aftertext' => esc_html__( '(e.g. Uploaded to this movie)', 'custom-post-type-ui' ),  
  381. ) ); 
  382.  
  383. echo $ui->get_text_input( array( 
  384. 'labeltext' => esc_html__( 'Filter Items List', 'custom-post-type-ui' ),  
  385. 'helptext' => esc_html__( 'Screen reader text for the filter links heading on the post type listing screen.', 'custom-post-type-ui' ),  
  386. 'namearray' => 'cpt_labels',  
  387. 'name' => 'filter_items_list',  
  388. 'textvalue' => ( isset( $current['labels']['filter_items_list'] ) ) ? esc_attr( $current['labels']['filter_items_list'] ) : '',  
  389. 'aftertext' => esc_html__( '(e.g. Filter movies list)', 'custom-post-type-ui' ),  
  390. ) ); 
  391.  
  392. echo $ui->get_text_input( array( 
  393. 'labeltext' => esc_html__( 'Items List Navigation', 'custom-post-type-ui' ),  
  394. 'helptext' => esc_html__( 'Screen reader text for the pagination heading on the post type listing screen.', 'custom-post-type-ui' ),  
  395. 'namearray' => 'cpt_labels',  
  396. 'name' => 'items_list_navigation',  
  397. 'textvalue' => ( isset( $current['labels']['items_list_navigation'] ) ) ? esc_attr( $current['labels']['items_list_navigation'] ) : '',  
  398. 'aftertext' => esc_html__( '(e.g. Movies list navigation)', 'custom-post-type-ui' ),  
  399. ) ); 
  400.  
  401. echo $ui->get_text_input( array( 
  402. 'labeltext' => esc_html__( 'Items List', 'custom-post-type-ui' ),  
  403. 'helptext' => esc_html__( 'Screen reader text for the items list heading on the post type listing screen.', 'custom-post-type-ui' ),  
  404. 'namearray' => 'cpt_labels',  
  405. 'name' => 'items_list',  
  406. 'textvalue' => ( isset( $current['labels']['items_list'] ) ) ? esc_attr( $current['labels']['items_list'] ) : '',  
  407. 'aftertext' => esc_html__( '(e.g. Movies list)', 'custom-post-type-ui' ),  
  408. ) ); 
  409.  
  410. echo $ui->get_text_input( array( 
  411. 'labeltext' => esc_html__( 'Attributes', 'custom-post-type-ui' ),  
  412. 'helptext' => esc_html__( 'Used for the title of the post attributes meta box.', 'custom-post-type-ui' ),  
  413. 'namearray' => 'cpt_labels',  
  414. 'name' => 'attributes',  
  415. 'textvalue' => ( isset( $current['labels']['attributes'] ) ) ? esc_attr( $current['labels']['attributes'] ) : '',  
  416. 'aftertext' => esc_html__( '(e.g. Movies Attributes)', 'custom-post-type-ui' ),  
  417. ) ); 
  418. ?> 
  419. </table> 
  420. </div> 
  421. </div> 
  422. </div> 
  423. <div class="cptui-section postbox"> 
  424. <button type="button" class="handlediv button-link" aria-expanded="true"> 
  425. <span class="screen-reader-text"><?php esc_html_e( 'Toggle panel: Settings', 'custom-post-type-ui' ); ?></span> 
  426. <span class="toggle-indicator" aria-hidden="true"></span> 
  427. </button> 
  428. <h2 class="hndle"> 
  429. <span><?php esc_html_e( 'Settings', 'custom-post-type-ui' ); ?></span> 
  430. </h2> 
  431. <div class="inside"> 
  432. <div class="main"> 
  433. <table class="form-table cptui-table"> 
  434. <?php 
  435. $select = array( 
  436. 'options' => array( 
  437. array( 'attr' => '0', 'text' => esc_attr__( 'False', 'custom-post-type-ui' ) ),  
  438. array( 'attr' => '1', 'text' => esc_attr__( 'True', 'custom-post-type-ui' ), 'default' => 'true' ),  
  439. ),  
  440. ); 
  441. $selected = ( isset( $current ) ) ? disp_boolean( $current['public'] ) : ''; 
  442. $select['selected'] = ( ! empty( $selected ) ) ? $current['public'] : ''; 
  443. echo $ui->get_select_input( array( 
  444. 'namearray' => 'cpt_custom_post_type',  
  445. 'name' => 'public',  
  446. 'labeltext' => esc_html__( 'Public', 'custom-post-type-ui' ),  
  447. 'aftertext' => esc_html__( '(CPTUI default: true) Whether or not posts of this type should be shown in the admin UI and is publicly queryable.', 'custom-post-type-ui' ),  
  448. 'selections' => $select,  
  449. ) ); 
  450.  
  451. $select = array( 
  452. 'options' => array( 
  453. array( 'attr' => '0', 'text' => esc_attr__( 'False', 'custom-post-type-ui' ) ),  
  454. array( 'attr' => '1', 'text' => esc_attr__( 'True', 'custom-post-type-ui' ), 'default' => 'true' ),  
  455. ),  
  456. ); 
  457. $selected = ( isset( $current ) && ! empty( $current['publicly_queryable'] ) ) ? disp_boolean( $current['publicly_queryable'] ) : ''; 
  458. $select['selected'] = ( ! empty( $selected ) ) ? $current['publicly_queryable'] : ''; 
  459. echo $ui->get_select_input( array( 
  460. 'namearray' => 'cpt_custom_post_type',  
  461. 'name' => 'publicly_queryable',  
  462. 'labeltext' => esc_html__( 'Publicly Queryable', 'custom-post-type-ui' ),  
  463. 'aftertext' => esc_html__( '(default: true) Whether or not queries can be performed on the front end as part of parse_request()', 'custom-post-type-ui' ),  
  464. 'selections' => $select,  
  465. ) ); 
  466.  
  467. $select = array( 
  468. 'options' => array( 
  469. array( 'attr' => '0', 'text' => esc_attr__( 'False', 'custom-post-type-ui' ) ),  
  470. array( 'attr' => '1', 'text' => esc_attr__( 'True', 'custom-post-type-ui' ), 'default' => 'true' ),  
  471. ),  
  472. ); 
  473. $selected = ( isset( $current ) ) ? disp_boolean( $current['show_ui'] ) : ''; 
  474. $select['selected'] = ( ! empty( $selected ) ) ? $current['show_ui'] : ''; 
  475. echo $ui->get_select_input( array( 
  476. 'namearray' => 'cpt_custom_post_type',  
  477. 'name' => 'show_ui',  
  478. 'labeltext' => esc_html__( 'Show UI', 'custom-post-type-ui' ),  
  479. 'aftertext' => esc_html__( '(default: true) Whether or not to generate a default UI for managing this post type.', 'custom-post-type-ui' ),  
  480. 'selections' => $select,  
  481. ) ); 
  482.  
  483. $select = array( 
  484. 'options' => array( 
  485. array( 'attr' => '0', 'text' => esc_attr__( 'False', 'custom-post-type-ui' ) ),  
  486. array( 'attr' => '1', 'text' => esc_attr__( 'True', 'custom-post-type-ui' ), 'default' => 'true' ),  
  487. ),  
  488. ); 
  489. $selected = ( isset( $current ) && ! empty( $current['show_in_nav_menus'] ) ) ? disp_boolean( $current['show_in_nav_menus'] ) : ''; 
  490. $select['selected'] = ( ! empty( $selected ) && ! empty( $current['show_in_nav_menus'] ) ) ? $current['show_in_nav_menus'] : ''; 
  491. echo $ui->get_select_input( array( 
  492. 'namearray' => 'cpt_custom_post_type',  
  493. 'name' => 'show_in_nav_menus',  
  494. 'labeltext' => esc_html__( 'Show in Nav Menus', 'custom-post-type-ui' ),  
  495. 'aftertext' => esc_html__( '(CPTUI default: true) Whether or not this post type is available for selection in navigation menus.', 'custom-post-type-ui' ),  
  496. 'selections' => $select,  
  497. ) ); 
  498.  
  499. $select = array( 
  500. 'options' => array( 
  501. array( 'attr' => '0', 'text' => esc_attr__( 'False', 'custom-post-type-ui' ), 'default' => 'false' ),  
  502. array( 'attr' => '1', 'text' => esc_attr__( 'True', 'custom-post-type-ui' ) ),  
  503. ),  
  504. ); 
  505. $selected = ( isset( $current ) && ! empty( $current['show_in_rest'] ) ) ? disp_boolean( $current['show_in_rest'] ) : ''; 
  506. $select['selected'] = ( ! empty( $selected ) && ! empty( $current['show_in_rest'] ) ) ? $current['show_in_rest'] : ''; 
  507. echo $ui->get_select_input( array( 
  508. 'namearray' => 'cpt_custom_post_type',  
  509. 'name' => 'show_in_rest',  
  510. 'labeltext' => esc_html__( 'Show in REST API', 'custom-post-type-ui' ),  
  511. 'aftertext' => esc_html__( '(default: false) Whether or not to show this post type data in the WP REST API.', 'custom-post-type-ui' ),  
  512. 'selections' => $select,  
  513. ) ); 
  514.  
  515. echo $ui->get_text_input( array( 
  516. 'namearray' => 'cpt_custom_post_type',  
  517. 'name' => 'rest_base',  
  518. 'labeltext' => esc_html__( 'REST API base slug', 'custom-post-type-ui' ),  
  519. 'aftertext' => esc_attr__( 'Slug to use in REST API URLs.', 'custom-post-type-ui' ),  
  520. 'textvalue' => ( isset( $current['rest_base'] ) ) ? esc_attr( $current['rest_base'] ) : '',  
  521. ) ); 
  522.  
  523. echo $ui->get_tr_start() . $ui->get_th_start(); 
  524. echo $ui->get_label( 'has_archive', esc_html__( 'Has Archive', 'custom-post-type-ui' ) ); 
  525. echo $ui->get_p( esc_html__( 'If left blank, the archive slug will default to the post type slug.', 'custom-post-type-ui' ) ); 
  526. echo $ui->get_th_end() . $ui->get_td_start(); 
  527.  
  528. $select = array( 
  529. 'options' => array( 
  530. array( 'attr' => '0', 'text' => esc_attr__( 'False', 'custom-post-type-ui' ), 'default' => 'true' ),  
  531. array( 'attr' => '1', 'text' => esc_attr__( 'True', 'custom-post-type-ui' ) ),  
  532. ),  
  533. ); 
  534. $selected = ( isset( $current ) ) ? disp_boolean( $current['has_archive'] ) : ''; 
  535. $select['selected'] = ( ! empty( $selected ) ) ? $current['has_archive'] : ''; 
  536. echo $ui->get_select_input( array( 
  537. 'namearray' => 'cpt_custom_post_type',  
  538. 'name' => 'has_archive',  
  539. 'aftertext' => esc_html__( '(default: false) Whether or not the post type will have a post type archive URL.', 'custom-post-type-ui' ),  
  540. 'selections' => $select,  
  541. 'wrap' => false,  
  542. ) ); 
  543.  
  544. echo '<br/>'; 
  545.  
  546. echo $ui->get_text_input( array( 
  547. 'namearray' => 'cpt_custom_post_type',  
  548. 'name' => 'has_archive_string',  
  549. 'textvalue' => ( isset( $current['has_archive_string'] ) ) ? esc_attr( $current['has_archive_string'] ) : '',  
  550. 'aftertext' => esc_attr__( 'Slug to be used for archive URL.', 'custom-post-type-ui' ),  
  551. 'helptext_after' => true,  
  552. 'wrap' => false,  
  553. ) ); 
  554. echo $ui->get_td_end() . $ui->get_tr_end(); 
  555.  
  556. $select = array( 
  557. 'options' => array( 
  558. array( 'attr' => '0', 'text' => esc_attr__( 'False', 'custom-post-type-ui' ), 'default' => 'true' ),  
  559. array( 'attr' => '1', 'text' => esc_attr__( 'True', 'custom-post-type-ui' ) ),  
  560. ),  
  561. ); 
  562. $selected = ( isset( $current ) ) ? disp_boolean( $current['exclude_from_search'] ) : ''; 
  563. $select['selected'] = ( ! empty( $selected ) ) ? $current['exclude_from_search'] : ''; 
  564. echo $ui->get_select_input( array( 
  565. 'namearray' => 'cpt_custom_post_type',  
  566. 'name' => 'exclude_from_search',  
  567. 'labeltext' => esc_html__( 'Exclude From Search', 'custom-post-type-ui' ),  
  568. 'aftertext' => esc_html__( '(default: false) Whether or not to exclude posts with this post type from front end search results.', 'custom-post-type-ui' ),  
  569. 'selections' => $select,  
  570. ) ); 
  571.  
  572. echo $ui->get_text_input( array( 
  573. 'namearray' => 'cpt_custom_post_type',  
  574. 'name' => 'capability_type',  
  575. 'textvalue' => ( isset( $current['capability_type'] ) ) ? esc_attr( $current['capability_type'] ) : 'post',  
  576. 'labeltext' => esc_html__( 'Capability Type', 'custom-post-type-ui' ),  
  577. 'helptext' => esc_html__( 'The post type to use for checking read, edit, and delete capabilities.', 'custom-post-type-ui' ),  
  578. ) ); 
  579.  
  580. $select = array( 
  581. 'options' => array( 
  582. array( 'attr' => '0', 'text' => esc_attr__( 'False', 'custom-post-type-ui' ), 'default' => 'true' ),  
  583. array( 'attr' => '1', 'text' => esc_attr__( 'True', 'custom-post-type-ui' ) ),  
  584. ),  
  585. ); 
  586. $selected = ( isset( $current ) ) ? disp_boolean( $current['hierarchical'] ) : ''; 
  587. $select['selected'] = ( ! empty( $selected ) ) ? $current['hierarchical'] : ''; 
  588. echo $ui->get_select_input( array( 
  589. 'namearray' => 'cpt_custom_post_type',  
  590. 'name' => 'hierarchical',  
  591. 'labeltext' => esc_html__( 'Hierarchical', 'custom-post-type-ui' ),  
  592. 'aftertext' => esc_html__( '(default: false) Whether or not the post type can have parent-child relationships.', 'custom-post-type-ui' ),  
  593. 'selections' => $select,  
  594. ) ); 
  595.  
  596. $select = array( 
  597. 'options' => array( 
  598. array( 'attr' => '0', 'text' => esc_attr__( 'False', 'custom-post-type-ui' ) ),  
  599. array( 'attr' => '1', 'text' => esc_attr__( 'True', 'custom-post-type-ui' ), 'default' => 'true' ),  
  600. ),  
  601. ); 
  602. $selected = ( isset( $current ) ) ? disp_boolean( $current['rewrite'] ) : ''; 
  603. $select['selected'] = ( ! empty( $selected ) ) ? $current['rewrite'] : ''; 
  604. echo $ui->get_select_input( array( 
  605. 'namearray' => 'cpt_custom_post_type',  
  606. 'name' => 'rewrite',  
  607. 'labeltext' => esc_html__( 'Rewrite', 'custom-post-type-ui' ),  
  608. 'aftertext' => esc_html__( '(default: true) Whether or not WordPress should use rewrites for this post type.', 'custom-post-type-ui' ),  
  609. 'selections' => $select,  
  610. ) ); 
  611.  
  612. echo $ui->get_text_input( array( 
  613. 'namearray' => 'cpt_custom_post_type',  
  614. 'name' => 'rewrite_slug',  
  615. 'textvalue' => ( isset( $current['rewrite_slug'] ) ) ? esc_attr( $current['rewrite_slug'] ) : '',  
  616. 'labeltext' => esc_html__( 'Custom Rewrite Slug', 'custom-post-type-ui' ),  
  617. 'aftertext' => esc_attr__( '(default: post type slug)', 'custom-post-type-ui' ),  
  618. 'helptext' => esc_html__( 'Custom post type slug to use instead of the default.', 'custom-post-type-ui' ),  
  619. ) ); 
  620.  
  621. $select = array( 
  622. 'options' => array( 
  623. array( 'attr' => '0', 'text' => esc_attr__( 'False', 'custom-post-type-ui' ) ),  
  624. array( 'attr' => '1', 'text' => esc_attr__( 'True', 'custom-post-type-ui' ), 'default' => 'true' ),  
  625. ),  
  626. ); 
  627. $selected = ( isset( $current ) ) ? disp_boolean( $current['rewrite_withfront'] ) : ''; 
  628. $select['selected'] = ( ! empty( $selected ) ) ? $current['rewrite_withfront'] : ''; 
  629. echo $ui->get_select_input( array( 
  630. 'namearray' => 'cpt_custom_post_type',  
  631. 'name' => 'rewrite_withfront',  
  632. 'labeltext' => esc_html__( 'With Front', 'custom-post-type-ui' ),  
  633. 'aftertext' => esc_html__( '(default: true) Should the permastruct be prepended with the front base.', 'custom-post-type-ui' ),  
  634. 'selections' => $select,  
  635. ) ); 
  636.  
  637. $select = array( 
  638. 'options' => array( 
  639. array( 'attr' => '0', 'text' => esc_attr__( 'False', 'custom-post-type-ui' ) ),  
  640. array( 'attr' => '1', 'text' => esc_attr__( 'True', 'custom-post-type-ui' ), 'default' => 'true' ),  
  641. ),  
  642. ); 
  643. $selected = ( isset( $current ) ) ? disp_boolean( $current['query_var'] ) : ''; 
  644. $select['selected'] = ( ! empty( $selected ) ) ? $current['query_var'] : ''; 
  645. echo $ui->get_select_input( array( 
  646. 'namearray' => 'cpt_custom_post_type',  
  647. 'name' => 'query_var',  
  648. 'labeltext' => esc_html__( 'Query Var', 'custom-post-type-ui' ),  
  649. 'aftertext' => esc_html__( '(default: true) Sets the query_var key for this post type.', 'custom-post-type-ui' ),  
  650. 'selections' => $select,  
  651. ) ); 
  652.  
  653. echo $ui->get_text_input( array( 
  654. 'namearray' => 'cpt_custom_post_type',  
  655. 'name' => 'query_var_slug',  
  656. 'textvalue' => ( isset( $current['query_var_slug'] ) ) ? esc_attr( $current['query_var_slug'] ) : '',  
  657. 'labeltext' => esc_html__( 'Custom Query Var Slug', 'custom-post-type-ui' ),  
  658. 'aftertext' => esc_attr__( '(default: post type slug) Query var needs to be true to use.', 'custom-post-type-ui' ),  
  659. 'helptext' => esc_html__( 'Custom query var slug to use instead of the default.', 'custom-post-type-ui' ),  
  660. ) ); 
  661.  
  662. echo $ui->get_tr_start() . $ui->get_th_start(); 
  663. echo $ui->get_label( 'menu_position', esc_html__( 'Menu Position', 'custom-post-type-ui' ) ); 
  664. echo $ui->get_p( 
  665. sprintf( 
  666. esc_html__( 
  667. 'See %s in the "menu_position" section. Range of 5-100',  
  668. 'custom-post-type-ui' 
  669. ),  
  670. sprintf( 
  671. '<a href="http://codex.wordpress.org/Function_Reference/register_post_type#Parameters" target="_blank">%s</a>',  
  672. esc_html__( 'Available options', 'custom-post-type-ui' ) 
  673. ); 
  674.  
  675. echo $ui->get_th_end() . $ui->get_td_start(); 
  676. echo $ui->get_text_input( array( 
  677. 'namearray' => 'cpt_custom_post_type',  
  678. 'name' => 'menu_position',  
  679. 'textvalue' => ( isset( $current['menu_position'] ) ) ? esc_attr( $current['menu_position'] ) : '',  
  680. 'helptext' => esc_html__( 'The position in the menu order the post type should appear. show_in_menu must be true.', 'custom-post-type-ui' ),  
  681. 'wrap' => false,  
  682. ) ); 
  683. echo $ui->get_td_end() . $ui->get_tr_end(); 
  684.  
  685. echo $ui->get_tr_start() . $ui->get_th_start(); 
  686. echo $ui->get_label( 'show_in_menu', esc_html__( 'Show in Menu', 'custom-post-type-ui' ) ); 
  687. echo $ui->get_p( esc_html__( '"Show UI" must be "true". If an existing top level page such as "tools.php" is indicated for second input, post type will be sub menu of that.', 'custom-post-type-ui' ) ); 
  688. echo $ui->get_th_end() . $ui->get_td_start(); 
  689.  
  690. $select = array( 
  691. 'options' => array( 
  692. array( 'attr' => '0', 'text' => esc_attr__( 'False', 'custom-post-type-ui' ) ),  
  693. array( 'attr' => '1', 'text' => esc_attr__( 'True', 'custom-post-type-ui' ), 'default' => 'true' ),  
  694. ),  
  695. ); 
  696. $selected = ( isset( $current ) ) ? disp_boolean( $current['show_in_menu'] ) : ''; 
  697. $select['selected'] = ( ! empty( $selected ) ) ? $current['show_in_menu'] : ''; 
  698. echo $ui->get_select_input( array( 
  699. 'namearray' => 'cpt_custom_post_type',  
  700. 'name' => 'show_in_menu',  
  701. 'aftertext' => esc_html__( '(default: true) Whether or not to show the post type in the admin menu and where to show that menu.', 'custom-post-type-ui' ),  
  702. 'selections' => $select,  
  703. 'wrap' => false,  
  704. ) ); 
  705.  
  706. echo '<br/>'; 
  707.  
  708. echo $ui->get_text_input( array( 
  709. 'namearray' => 'cpt_custom_post_type',  
  710. 'name' => 'show_in_menu_string',  
  711. 'textvalue' => ( isset( $current['show_in_menu_string'] ) ) ? esc_attr( $current['show_in_menu_string'] ) : '',  
  712. 'helptext' => esc_attr__( 'The top-level admin menu page file name for which the post type should be in the sub menu of.', 'custom-post-type-ui' ),  
  713. 'helptext_after' => true,  
  714. 'wrap' => false,  
  715. ) ); 
  716. echo $ui->get_td_end() . $ui->get_tr_end(); 
  717.  
  718. echo $ui->get_tr_start() . $ui->get_th_start() . '<label for="menu_icon">' . __( 'Menu Icon', 'custom-post-type-ui' ) . '</label>' . $ui->get_th_end() . $ui->get_td_start(); 
  719. echo $ui->get_text_input( array( 
  720. 'namearray' => 'cpt_custom_post_type',  
  721. 'name' => 'menu_icon',  
  722. 'textvalue' => ( isset( $current['menu_icon'] ) ) ? esc_attr( $current['menu_icon'] ) : '',  
  723. 'aftertext' => esc_attr__( '(Full URL for icon or Dashicon class)', 'custom-post-type-ui' ),  
  724. 'helptext' => esc_html__( 'Image URL or Dashicon class name to use for icon. Custom image should be 20px by 20px.', 'custom-post-type-ui' ),  
  725. 'wrap' => false,  
  726. ) ); 
  727.  
  728. echo '<div class="cptui-spacer">'; 
  729.  
  730. echo $ui->get_button( array( 
  731. 'id' => 'cptui_choose_icon',  
  732. 'textvalue' => esc_attr__( 'Choose image icon', 'custom-post-type-ui' ),  
  733. ) ); 
  734. echo '</div>'; 
  735.  
  736. echo $ui->get_td_end() . $ui->get_tr_end(); 
  737.  
  738. echo $ui->get_tr_start() . $ui->get_th_start() . esc_html__( 'Supports', 'custom-post-type-ui' ); 
  739.  
  740. echo $ui->get_p( esc_html__( 'Add support for various available post editor features on the right. A checked value means the post type means the feature is supported.', 'custom_post_type_ui' ) ); 
  741.  
  742. echo $ui->get_p( esc_html__( 'Use the "None" option to explicitly set "supports" to false.', 'custom-post-type-ui' ) ); 
  743.  
  744. echo $ui->get_th_end() . $ui->get_td_start() . $ui->get_fieldset_start(); 
  745.  
  746. $title_checked = ( ! empty( $current['supports'] ) && is_array( $current['supports'] ) && in_array( 'title', $current['supports'] ) ) ? 'true' : 'false'; 
  747. if ( 'new' == $tab ) { 
  748. $title_checked = 'true'; 
  749. echo $ui->get_check_input( array( 
  750. 'checkvalue' => 'title',  
  751. 'checked' => $title_checked,  
  752. 'name' => 'title',  
  753. 'namearray' => 'cpt_supports',  
  754. 'textvalue' => 'title',  
  755. 'labeltext' => esc_html__( 'Title', 'custom-post-type-ui' ),  
  756. 'default' => true,  
  757. 'wrap' => false,  
  758. ) ); 
  759.  
  760. $editor_checked = ( ! empty( $current['supports'] ) && is_array( $current['supports'] ) && in_array( 'editor', $current['supports'] ) ) ? 'true' : 'false'; 
  761. if ( 'new' == $tab ) { 
  762. $editor_checked = 'true'; 
  763. echo $ui->get_check_input( array( 
  764. 'checkvalue' => 'editor',  
  765. 'checked' => $editor_checked,  
  766. 'name' => 'editor',  
  767. 'namearray' => 'cpt_supports',  
  768. 'textvalue' => 'editor',  
  769. 'labeltext' => esc_html__( 'Editor', 'custom-post-type-ui' ),  
  770. 'default' => true,  
  771. 'wrap' => false,  
  772. ) ); 
  773.  
  774. $thumb_checked = ( ! empty( $current['supports'] ) && is_array( $current['supports'] ) && in_array( 'thumbnail', $current['supports'] ) ) ? 'true' : 'false'; 
  775. if ( 'new' == $tab ) { 
  776. $thumb_checked = 'true'; 
  777. echo $ui->get_check_input( array( 
  778. 'checkvalue' => 'thumbnail',  
  779. 'checked' => $thumb_checked,  
  780. 'name' => 'thumbnail',  
  781. 'namearray' => 'cpt_supports',  
  782. 'textvalue' => 'thumbnail',  
  783. 'labeltext' => esc_html__( 'Featured Image', 'custom-post-type-ui' ),  
  784. 'default' => true,  
  785. 'wrap' => false,  
  786. ) ); 
  787.  
  788. echo $ui->get_check_input( array( 
  789. 'checkvalue' => 'excerpt',  
  790. 'checked' => ( ! empty( $current['supports'] ) && is_array( $current['supports'] ) && in_array( 'excerpt', $current['supports'] ) ) ? 'true' : 'false',  
  791. 'name' => 'excerpts',  
  792. 'namearray' => 'cpt_supports',  
  793. 'textvalue' => 'excerpt',  
  794. 'labeltext' => esc_html__( 'Excerpt', 'custom-post-type-ui' ),  
  795. 'default' => true,  
  796. 'wrap' => false,  
  797. ) ); 
  798.  
  799. echo $ui->get_check_input( array( 
  800. 'checkvalue' => 'trackbacks',  
  801. 'checked' => ( ! empty( $current['supports'] ) && is_array( $current['supports'] ) && in_array( 'trackbacks', $current['supports'] ) ) ? 'true' : 'false',  
  802. 'name' => 'trackbacks',  
  803. 'namearray' => 'cpt_supports',  
  804. 'textvalue' => 'trackbacks',  
  805. 'labeltext' => esc_html__( 'Trackbacks', 'custom-post-type-ui' ),  
  806. 'default' => true,  
  807. 'wrap' => false,  
  808. ) ); 
  809.  
  810. echo $ui->get_check_input( array( 
  811. 'checkvalue' => 'custom-fields',  
  812. 'checked' => ( ! empty( $current['supports'] ) && is_array( $current['supports'] ) && in_array( 'custom-fields', $current['supports'] ) ) ? 'true' : 'false',  
  813. 'name' => 'custom-fields',  
  814. 'namearray' => 'cpt_supports',  
  815. 'textvalue' => 'custom-fields',  
  816. 'labeltext' => esc_html__( 'Custom Fields', 'custom-post-type-ui' ),  
  817. 'default' => true,  
  818. 'wrap' => false,  
  819. ) ); 
  820.  
  821. echo $ui->get_check_input( array( 
  822. 'checkvalue' => 'comments',  
  823. 'checked' => ( ! empty( $current['supports'] ) && is_array( $current['supports'] ) && in_array( 'comments', $current['supports'] ) ) ? 'true' : 'false',  
  824. 'name' => 'comments',  
  825. 'namearray' => 'cpt_supports',  
  826. 'textvalue' => 'comments',  
  827. 'labeltext' => esc_html__( 'Comments', 'custom-post-type-ui' ),  
  828. 'default' => true,  
  829. 'wrap' => false,  
  830. ) ); 
  831.  
  832. echo $ui->get_check_input( array( 
  833. 'checkvalue' => 'revisions',  
  834. 'checked' => ( ! empty( $current['supports'] ) && is_array( $current['supports'] ) && in_array( 'revisions', $current['supports'] ) ) ? 'true' : 'false',  
  835. 'name' => 'revisions',  
  836. 'namearray' => 'cpt_supports',  
  837. 'textvalue' => 'revisions',  
  838. 'labeltext' => esc_html__( 'Revisions', 'custom-post-type-ui' ),  
  839. 'default' => true,  
  840. 'wrap' => false,  
  841. ) ); 
  842.  
  843. echo $ui->get_check_input( array( 
  844. 'checkvalue' => 'author',  
  845. 'checked' => ( ! empty( $current['supports'] ) && is_array( $current['supports'] ) && in_array( 'author', $current['supports'] ) ) ? 'true' : 'false',  
  846. 'name' => 'author',  
  847. 'namearray' => 'cpt_supports',  
  848. 'textvalue' => 'author',  
  849. 'labeltext' => esc_html__( 'Author', 'custom-post-type-ui' ),  
  850. 'default' => true,  
  851. 'wrap' => false,  
  852. ) ); 
  853.  
  854. echo $ui->get_check_input( array( 
  855. 'checkvalue' => 'page-attributes',  
  856. 'checked' => ( ! empty( $current['supports'] ) && is_array( $current['supports'] ) && in_array( 'page-attributes', $current['supports'] ) ) ? 'true' : 'false',  
  857. 'name' => 'page-attributes',  
  858. 'namearray' => 'cpt_supports',  
  859. 'textvalue' => 'page-attributes',  
  860. 'labeltext' => esc_html__( 'Page Attributes', 'custom-post-type-ui' ),  
  861. 'default' => true,  
  862. 'wrap' => false,  
  863. ) ); 
  864.  
  865. echo $ui->get_check_input( array( 
  866. 'checkvalue' => 'post-formats',  
  867. 'checked' => ( ! empty( $current['supports'] ) && is_array( $current['supports'] ) && in_array( 'post-formats', $current['supports'] ) ) ? 'true' : 'false',  
  868. 'name' => 'post-formats',  
  869. 'namearray' => 'cpt_supports',  
  870. 'textvalue' => 'post-formats',  
  871. 'labeltext' => esc_html__( 'Post Formats', 'custom-post-type-ui' ),  
  872. 'default' => true,  
  873. 'wrap' => false,  
  874. ) ); 
  875.  
  876. echo $ui->get_check_input( array( 
  877. 'checkvalue' => 'none',  
  878. 'checked' => ( ! empty( $current['supports'] ) && ( is_array( $current['supports'] ) && in_array( 'none', $current['supports'] ) ) ) ? 'true' : 'false',  
  879. 'name' => 'none',  
  880. 'namearray' => 'cpt_supports',  
  881. 'textvalue' => 'none',  
  882. 'labeltext' => esc_html__( 'None', 'custom-post-type-ui' ),  
  883. 'default' => false,  
  884. 'wrap' => false,  
  885. ) ); 
  886.  
  887. echo $ui->get_fieldset_end() . $ui->get_td_end() . $ui->get_tr_end(); 
  888.  
  889. echo $ui->get_tr_start() . $ui->get_th_start() . '<label for="custom_supports">' . esc_html__( 'Custom "Supports"', 'custom-post-type-ui' ) . '</label>'; 
  890. echo $ui->get_p( sprintf( esc_html__( 'Use this input to register custom "supports" values, separated by commas. Learn about this at %s', 'custom-post-type-ui' ), '<a href="http://docs.pluginize.com/article/28-third-party-support-upon-registration" target="_blank">' . esc_html__( 'Custom "Supports"', 'custom-post-type-ui' ) . '</a>' ) ); 
  891. echo $ui->get_th_end() . $ui->get_td_start(); 
  892. echo $ui->get_text_input( array( 
  893. 'namearray' => 'cpt_custom_post_type',  
  894. 'name' => 'custom_supports',  
  895. 'textvalue' => ( isset( $current['custom_supports'] ) ) ? esc_attr( $current['custom_supports'] ) : '',  
  896. 'helptext' => esc_attr__( 'Provide custom support slugs here.', 'custom-post-type-ui' ),  
  897. 'helptext_after' => true,  
  898. 'wrap' => false,  
  899. ) ); 
  900. echo $ui->get_td_end() . $ui->get_tr_end(); 
  901.  
  902. echo $ui->get_tr_start() . $ui->get_th_start() . esc_html__( 'Built-in Taxonomies', 'custom-post-type-ui' ); 
  903.  
  904. echo $ui->get_p( esc_html__( 'Add support for available registered taxonomies.', 'custom-post-type-ui' ) ); 
  905.  
  906. echo $ui->get_th_end() . $ui->get_td_start() . $ui->get_fieldset_start(); 
  907.  
  908. /** 
  909. * Filters the arguments for taxonomies to list for post type association. 
  910. * @since 1.0.0 
  911. * @param array $value Array of default arguments. 
  912. */ 
  913. $args = apply_filters( 'cptui_attach_taxonomies_to_post_type', array( 'public' => true ) ); 
  914.  
  915. // 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. 
  916. if ( ! is_array( $args ) ) { 
  917. $args = array( 'public' => true ); 
  918.  
  919. $add_taxes = get_taxonomies( $args, 'objects' ); 
  920. unset( $add_taxes['nav_menu'] ); unset( $add_taxes['post_format'] ); 
  921. foreach ( $add_taxes as $add_tax ) { 
  922.  
  923. $core_label = ( in_array( $add_tax->name, array( 'category', 'post_tag' ) ) ) ? __( '(WP Core)', 'custom-post-type-ui' ) : ''; 
  924. echo $ui->get_check_input( array( 
  925. 'checkvalue' => $add_tax->name,  
  926. 'checked' => ( ! empty( $current['taxonomies'] ) && is_array( $current['taxonomies'] ) && in_array( $add_tax->name, $current['taxonomies'] ) ) ? 'true' : 'false',  
  927. 'name' => $add_tax->name,  
  928. 'namearray' => 'cpt_addon_taxes',  
  929. 'textvalue' => $add_tax->name,  
  930. 'labeltext' => $add_tax->label . ' ' . $core_label,  
  931. 'helptext' => sprintf( esc_attr__( 'Adds %s support', 'custom-post-type-ui' ), $add_tax->label ),  
  932. 'wrap' => false,  
  933. ) ); 
  934. echo $ui->get_fieldset_end() . $ui->get_td_end() . $ui->get_tr_end(); 
  935. ?> 
  936. </table> 
  937. </div> 
  938. </div> 
  939. </div> 
  940.  
  941. <?php 
  942. /** 
  943. * Fires after the default fieldsets on the post editor screen. 
  944. * @since 1.3.0 
  945. * @param cptui_admin_ui $ui Admin UI instance. 
  946. */ 
  947. do_action( 'cptui_post_type_after_fieldsets', $ui ); ?> 
  948.  
  949. <p> 
  950. <?php 
  951. if ( ! empty( $_GET ) && ! empty( $_GET['action'] ) && 'edit' == $_GET['action'] ) { 
  952. /** 
  953. * Filters the text value to use on the button when editing. 
  954. * @since 1.0.0 
  955. * @param string $value Text to use for the button. 
  956. */ 
  957. ?> 
  958. <input type="submit" class="button-primary" name="cpt_submit" value="<?php echo esc_attr( apply_filters( 'cptui_post_type_submit_edit', __( 'Save Post Type', 'custom-post-type-ui' ) ) ); ?>" /> 
  959. <?php 
  960.  
  961. /** 
  962. * Filters the text value to use on the button when deleting. 
  963. * @since 1.0.0 
  964. * @param string $value Text to use for the button. 
  965. */ 
  966. ?> 
  967. <input type="submit" class="button-secondary" name="cpt_delete" id="cpt_submit_delete" value="<?php echo esc_attr( apply_filters( 'cptui_post_type_submit_delete', __( 'Delete Post Type', 'custom-post-type-ui' ) ) ); ?>" /> 
  968. <?php 
  969. } else { 
  970.  
  971. /** 
  972. * Filters the text value to use on the button when adding. 
  973. * @since 1.0.0 
  974. * @param string $value Text to use for the button. 
  975. */ 
  976. ?> 
  977. <input type="submit" class="button-primary" name="cpt_submit" value="<?php echo esc_attr( apply_filters( 'cptui_post_type_submit_add', __( 'Add Post Type', 'custom-post-type-ui' ) ) ); ?>" /> 
  978. <?php } ?> 
  979. </p> 
  980. </div> 
  981. </form> 
  982. </div><!-- End .wrap --> 
  983. <?php