Custom Post Type UI - Version 1.7.0

Version Description

  • 2019-11-06 =
  • Actually added this time: Delete with user support for post types. Managed to miss the code with 1.6.0 which was a long time ago.
  • Added: Ability to disable registration of post types or taxonomies, via code filter, without deleting them completely from settings.
  • Added: New post type labels introduced in WordPress 5.0.0.
  • Added: Link to Dashicon documentation for when editing menu icon. Props @juliekuehl
  • Added: Ability to automatically fill in additional labels based on chosen plural and singular label text.
  • Updated: Added post type templates documentation to help section.
  • Updated: Redirect user to the "add" tab if deleting the last post type or taxonomy created.
  • Updated: Touched up tab markup to match semantic improvements provided by WordPress 5.2.0.
  • Fixed: potential duplicate output of "parent_item_colon" with "Get Code" output.
  • Misc: Added code of conduct file to github repo. Props GaryJones.
Download this release

Release Info

Developer tw2113
Plugin Icon 128x128 Custom Post Type UI
Version 1.7.0
Comparing to
See all releases

Code changes from version 1.6.2 to 1.7.0

classes/class.cptui_admin_ui.php CHANGED
@@ -7,6 +7,8 @@
7
  * @author WebDevStudios
8
  * @since 1.0.0
9
  * @license GPL-2.0+
 
 
10
  */
11
 
12
  /**
@@ -91,7 +93,7 @@ class cptui_admin_ui {
91
  * @param array $args Array of arguments.
92
  * @return string $value Opening `<fieldset>` tag.
93
  */
94
- public function get_fieldset_start( $args = array() ) {
95
  $fieldset = '<fieldset';
96
 
97
  if ( ! empty( $args['id'] ) ) {
@@ -99,7 +101,7 @@ class cptui_admin_ui {
99
  }
100
 
101
  if ( ! empty( $args['classes'] ) ) {
102
- $classes = 'class="' . implode( ' ', $args['classes'] ) . '"';
103
  $fieldset .= ' ' . $classes;
104
  }
105
 
@@ -167,7 +169,7 @@ class cptui_admin_ui {
167
  * @return string $value `<label>` tag with filled out parts.
168
  */
169
  public function get_label( $label_for = '', $label_text = '' ) {
170
- return '<label for="' . esc_attr( $label_for ) . '">' . strip_tags( $label_text ) . '</label>';
171
  }
172
 
173
  /**
@@ -206,7 +208,7 @@ class cptui_admin_ui {
206
  * @return string Aria required attribute
207
  */
208
  public function get_aria_required( $required = false ) {
209
- $attr = ( $required ) ? 'true' : 'false';
210
  return 'aria-required="' . $attr . '"';
211
  }
212
 
@@ -290,9 +292,9 @@ class cptui_admin_ui {
290
  * @param array $args Arguments to use with the `<select>` input.
291
  * @return string $value Complete <select> input with options and selected attribute.
292
  */
293
- public function get_select_input( $args = array() ) {
294
  $defaults = $this->get_default_input_parameters(
295
- array( 'selections' => array() )
296
  );
297
 
298
  $args = wp_parse_args( $args, $defaults );
@@ -302,8 +304,12 @@ class cptui_admin_ui {
302
  $value = $this->get_tr_start();
303
  $value .= $this->get_th_start();
304
  $value .= $this->get_label( $args['name'], $args['labeltext'] );
305
- if ( $args['required'] ) { $value .= $this->get_required_span(); }
306
- if ( ! empty( $args['helptext'] ) ) { $value .= $this->get_help( $args['helptext'] ); }
 
 
 
 
307
  $value .= $this->get_th_end();
308
  $value .= $this->get_td_start();
309
  }
@@ -312,15 +318,15 @@ class cptui_admin_ui {
312
  if ( ! empty( $args['selections']['options'] ) && is_array( $args['selections']['options'] ) ) {
313
  foreach ( $args['selections']['options'] as $val ) {
314
  $result = '';
315
- $bool = disp_boolean( $val['attr'] );
316
 
317
  if ( is_numeric( $args['selections']['selected'] ) ) {
318
  $selected = disp_boolean( $args['selections']['selected'] );
319
- } elseif ( in_array( $args['selections']['selected'], array( 'true', 'false' ) ) ) {
320
  $selected = $args['selections']['selected'];
321
  }
322
 
323
- if ( ( ! empty( $selected ) ) && $selected === $bool ) {
324
  $result = ' selected="selected"';
325
  } else {
326
  if ( array_key_exists( 'default', $val ) && ! empty( $val['default'] ) ) {
@@ -359,21 +365,23 @@ class cptui_admin_ui {
359
  * @param array $args Arguments to use with the text input.
360
  * @return string Complete text `<input>` with proper attributes.
361
  */
362
- public function get_text_input( $args = array() ) {
363
  $defaults = $this->get_default_input_parameters(
364
- array(
365
- 'maxlength' => '',
366
- 'onblur' => '',
367
- )
368
  );
369
- $args = wp_parse_args( $args, $defaults );
370
 
371
  $value = '';
372
  if ( $args['wrap'] ) {
373
  $value .= $this->get_tr_start();
374
  $value .= $this->get_th_start();
375
  $value .= $this->get_label( $args['name'], $args['labeltext'] );
376
- if ( $args['required'] ) { $value .= $this->get_required_span(); }
 
 
377
  $value .= $this->get_th_end();
378
  $value .= $this->get_td_start();
379
  }
@@ -398,6 +406,12 @@ class cptui_admin_ui {
398
  }
399
  }
400
 
 
 
 
 
 
 
401
  $value .= ' />';
402
 
403
  if ( ! empty( $args['aftertext'] ) ) {
@@ -424,14 +438,14 @@ class cptui_admin_ui {
424
  * @param array $args Arguments to use with the textarea input.
425
  * @return string $value Complete <textarea> input with proper attributes.
426
  */
427
- public function get_textarea_input( $args = array() ) {
428
  $defaults = $this->get_default_input_parameters(
429
- array(
430
  'rows' => '',
431
  'cols' => '',
432
- )
433
  );
434
- $args = wp_parse_args( $args, $defaults );
435
 
436
  $value = '';
437
 
@@ -439,7 +453,9 @@ class cptui_admin_ui {
439
  $value .= $this->get_tr_start();
440
  $value .= $this->get_th_start();
441
  $value .= $this->get_label( $args['name'], $args['labeltext'] );
442
- if ( $args['required'] ) { $value .= $this->get_required_span(); }
 
 
443
  $value .= $this->get_th_end();
444
  $value .= $this->get_td_start();
445
  }
@@ -470,24 +486,25 @@ class cptui_admin_ui {
470
  * @param array $args Arguments to use with the checkbox input.
471
  * @return string $value Complete checkbox `<input>` with proper attributes.
472
  */
473
- public function get_check_input( $args = array() ) {
474
  $defaults = $this->get_default_input_parameters(
475
- array(
476
- 'checkvalue' => '',
477
- 'checked' => 'true',
478
- 'checklisttext' => '',
479
- 'default' => false,
480
- )
481
  );
482
-
483
- $args = wp_parse_args( $args, $defaults );
484
 
485
  $value = '';
486
  if ( $args['wrap'] ) {
487
  $value .= $this->get_tr_start();
488
  $value .= $this->get_th_start();
489
  $value .= $args['checklisttext'];
490
- if ( $args['required'] ) { $value .= $this->get_required_span(); }
 
 
491
  $value .= $this->get_th_end();
492
  $value .= $this->get_td_start();
493
  }
@@ -516,8 +533,8 @@ class cptui_admin_ui {
516
  * @param array $args Arguments to use with the button input.
517
  * @return string Complete button `<input>`.
518
  */
519
- public function get_button( $args = array() ) {
520
- $value = '';
521
  $value .= '<input id="' . $args['id'] . '" class="button" type="button" value="' . $args['textvalue'] . '" />';
522
 
523
  return $value;
@@ -531,9 +548,9 @@ class cptui_admin_ui {
531
  * @param array $additions Arguments array to merge with our defaults.
532
  * @return array $value Merged arrays for our default parameters.
533
  */
534
- public function get_default_input_parameters( $additions = array() ) {
535
  return array_merge(
536
- array(
537
  'namearray' => '',
538
  'name' => '',
539
  'textvalue' => '',
@@ -544,7 +561,7 @@ class cptui_admin_ui {
544
  'required' => false,
545
  'wrap' => true,
546
  'placeholder' => true,
547
- ),
548
  (array) $additions
549
  );
550
  }
7
  * @author WebDevStudios
8
  * @since 1.0.0
9
  * @license GPL-2.0+
10
+ *
11
+ * phpcs:disable WebDevStudios.All.RequireAuthor
12
  */
13
 
14
  /**
93
  * @param array $args Array of arguments.
94
  * @return string $value Opening `<fieldset>` tag.
95
  */
96
+ public function get_fieldset_start( $args = [] ) {
97
  $fieldset = '<fieldset';
98
 
99
  if ( ! empty( $args['id'] ) ) {
101
  }
102
 
103
  if ( ! empty( $args['classes'] ) ) {
104
+ $classes = 'class="' . implode( ' ', $args['classes'] ) . '"';
105
  $fieldset .= ' ' . $classes;
106
  }
107
 
169
  * @return string $value `<label>` tag with filled out parts.
170
  */
171
  public function get_label( $label_for = '', $label_text = '' ) {
172
+ return '<label for="' . esc_attr( $label_for ) . '">' . wp_strip_all_tags( $label_text ) . '</label>';
173
  }
174
 
175
  /**
208
  * @return string Aria required attribute
209
  */
210
  public function get_aria_required( $required = false ) {
211
+ $attr = $required ? 'true' : 'false';
212
  return 'aria-required="' . $attr . '"';
213
  }
214
 
292
  * @param array $args Arguments to use with the `<select>` input.
293
  * @return string $value Complete <select> input with options and selected attribute.
294
  */
295
+ public function get_select_input( $args = [] ) {
296
  $defaults = $this->get_default_input_parameters(
297
+ [ 'selections' => [] ]
298
  );
299
 
300
  $args = wp_parse_args( $args, $defaults );
304
  $value = $this->get_tr_start();
305
  $value .= $this->get_th_start();
306
  $value .= $this->get_label( $args['name'], $args['labeltext'] );
307
+ if ( $args['required'] ) {
308
+ $value .= $this->get_required_span();
309
+ }
310
+ if ( ! empty( $args['helptext'] ) ) {
311
+ $value .= $this->get_help( $args['helptext'] );
312
+ }
313
  $value .= $this->get_th_end();
314
  $value .= $this->get_td_start();
315
  }
318
  if ( ! empty( $args['selections']['options'] ) && is_array( $args['selections']['options'] ) ) {
319
  foreach ( $args['selections']['options'] as $val ) {
320
  $result = '';
321
+ $bool = disp_boolean( $val['attr'] );
322
 
323
  if ( is_numeric( $args['selections']['selected'] ) ) {
324
  $selected = disp_boolean( $args['selections']['selected'] );
325
+ } elseif ( in_array( $args['selections']['selected'], [ 'true', 'false' ], true ) ) {
326
  $selected = $args['selections']['selected'];
327
  }
328
 
329
+ if ( ! empty( $selected ) && $selected === $bool ) {
330
  $result = ' selected="selected"';
331
  } else {
332
  if ( array_key_exists( 'default', $val ) && ! empty( $val['default'] ) ) {
365
  * @param array $args Arguments to use with the text input.
366
  * @return string Complete text `<input>` with proper attributes.
367
  */
368
+ public function get_text_input( $args = [] ) {
369
  $defaults = $this->get_default_input_parameters(
370
+ [
371
+ 'maxlength' => '',
372
+ 'onblur' => '',
373
+ ]
374
  );
375
+ $args = wp_parse_args( $args, $defaults );
376
 
377
  $value = '';
378
  if ( $args['wrap'] ) {
379
  $value .= $this->get_tr_start();
380
  $value .= $this->get_th_start();
381
  $value .= $this->get_label( $args['name'], $args['labeltext'] );
382
+ if ( $args['required'] ) {
383
+ $value .= $this->get_required_span();
384
+ }
385
  $value .= $this->get_th_end();
386
  $value .= $this->get_td_start();
387
  }
406
  }
407
  }
408
 
409
+ if ( ! empty( $args['data'] ) ) {
410
+ foreach ( $args['data'] as $dkey => $dvalue ) {
411
+ $value .= " data-{$dkey}=\"{$dvalue}\"";
412
+ }
413
+ }
414
+
415
  $value .= ' />';
416
 
417
  if ( ! empty( $args['aftertext'] ) ) {
438
  * @param array $args Arguments to use with the textarea input.
439
  * @return string $value Complete <textarea> input with proper attributes.
440
  */
441
+ public function get_textarea_input( $args = [] ) {
442
  $defaults = $this->get_default_input_parameters(
443
+ [
444
  'rows' => '',
445
  'cols' => '',
446
+ ]
447
  );
448
+ $args = wp_parse_args( $args, $defaults );
449
 
450
  $value = '';
451
 
453
  $value .= $this->get_tr_start();
454
  $value .= $this->get_th_start();
455
  $value .= $this->get_label( $args['name'], $args['labeltext'] );
456
+ if ( $args['required'] ) {
457
+ $value .= $this->get_required_span();
458
+ }
459
  $value .= $this->get_th_end();
460
  $value .= $this->get_td_start();
461
  }
486
  * @param array $args Arguments to use with the checkbox input.
487
  * @return string $value Complete checkbox `<input>` with proper attributes.
488
  */
489
+ public function get_check_input( $args = [] ) {
490
  $defaults = $this->get_default_input_parameters(
491
+ [
492
+ 'checkvalue' => '',
493
+ 'checked' => 'true',
494
+ 'checklisttext' => '',
495
+ 'default' => false,
496
+ ]
497
  );
498
+ $args = wp_parse_args( $args, $defaults );
 
499
 
500
  $value = '';
501
  if ( $args['wrap'] ) {
502
  $value .= $this->get_tr_start();
503
  $value .= $this->get_th_start();
504
  $value .= $args['checklisttext'];
505
+ if ( $args['required'] ) {
506
+ $value .= $this->get_required_span();
507
+ }
508
  $value .= $this->get_th_end();
509
  $value .= $this->get_td_start();
510
  }
533
  * @param array $args Arguments to use with the button input.
534
  * @return string Complete button `<input>`.
535
  */
536
+ public function get_button( $args = [] ) {
537
+ $value = '';
538
  $value .= '<input id="' . $args['id'] . '" class="button" type="button" value="' . $args['textvalue'] . '" />';
539
 
540
  return $value;
548
  * @param array $additions Arguments array to merge with our defaults.
549
  * @return array $value Merged arrays for our default parameters.
550
  */
551
+ public function get_default_input_parameters( $additions = [] ) {
552
  return array_merge(
553
+ [
554
  'namearray' => '',
555
  'name' => '',
556
  'textvalue' => '',
561
  'required' => false,
562
  'wrap' => true,
563
  'placeholder' => true,
564
+ ],
565
  (array) $additions
566
  );
567
  }
classes/class.cptui_debug_info.php CHANGED
@@ -23,7 +23,7 @@ class CPTUI_Debug_Info {
23
  ?>
24
  <p><?php _e( 'If you have sought support for Custom Post Type UI on the forums, you may be requested to send the information below to the plugin developer. Simply insert the email they provided in the input field at the bottom and click the "Send debug info" button. Only the data below will be sent to them.', 'custom-post-type-ui' ); ?></p>
25
  <label for="cptui_audit_textarea">
26
- <textarea readonly="readonly" aria-readonly="true" id="cptui-audit-textarea" name="cptui_audit_textarea" rows="20" cols="100">
27
  <?php echo $this->system_status(); ?>
28
  </textarea></label>
29
  <?php
@@ -92,7 +92,7 @@ class CPTUI_Debug_Info {
92
  // Standard plugins - active.
93
  echo "\n";
94
 
95
- $active = get_option( 'active_plugins', array() );
96
  $ac_count = count( $active );
97
  $ic_count = $pg_count - $ac_count;
98
 
@@ -123,7 +123,7 @@ class CPTUI_Debug_Info {
123
  if ( is_multisite() ) :
124
 
125
  $net_plugins = wp_get_active_network_plugins();
126
- $net_active = get_site_option( 'active_sitewide_plugins', array() );
127
 
128
  echo "\n";
129
  echo 'NETWORK ACTIVE PLUGINS: (' . count( $net_plugins ) . ')' . "\n\n";
@@ -210,7 +210,7 @@ class CPTUI_Debug_Info {
210
  * @param array $args Array of arguments for the method. Optional.
211
  * @return bool
212
  */
213
- public function send_email( $args = array() ) {
214
 
215
  if ( ! isset( $args['email'] ) || ! is_email( $args['email'] ) ) {
216
  return false;
23
  ?>
24
  <p><?php _e( 'If you have sought support for Custom Post Type UI on the forums, you may be requested to send the information below to the plugin developer. Simply insert the email they provided in the input field at the bottom and click the "Send debug info" button. Only the data below will be sent to them.', 'custom-post-type-ui' ); ?></p>
25
  <label for="cptui_audit_textarea">
26
+ <textarea readonly="readonly" aria-readonly="true" id="cptui-audit-textarea" name="cptui_audit_textarea" rows="20" cols="100" class="large-text code">
27
  <?php echo $this->system_status(); ?>
28
  </textarea></label>
29
  <?php
92
  // Standard plugins - active.
93
  echo "\n";
94
 
95
+ $active = get_option( 'active_plugins', [] );
96
  $ac_count = count( $active );
97
  $ic_count = $pg_count - $ac_count;
98
 
123
  if ( is_multisite() ) :
124
 
125
  $net_plugins = wp_get_active_network_plugins();
126
+ $net_active = get_site_option( 'active_sitewide_plugins', [] );
127
 
128
  echo "\n";
129
  echo 'NETWORK ACTIVE PLUGINS: (' . count( $net_plugins ) . ')' . "\n\n";
210
  * @param array $args Array of arguments for the method. Optional.
211
  * @return bool
212
  */
213
+ public function send_email( $args = [] ) {
214
 
215
  if ( ! isset( $args['email'] ) || ! is_email( $args['email'] ) ) {
216
  return false;
css/cptui.css CHANGED
@@ -127,7 +127,6 @@
127
  .cptui_tax_get_code {
128
  height: 300px;
129
  resize: vertical;
130
- width: 100%;
131
  }
132
 
133
  .about-wrap .cptui-feature {
@@ -313,7 +312,7 @@ fieldset .cptui-help {
313
  -ms-flex-pack: justify;
314
  justify-content: space-between;
315
  -ms-flex-line-pack: stretch;
316
- align-content: stretch;
317
  -ms-flex-align: start;
318
  align-items: flex-start;
319
  margin: 20px 0;
@@ -325,7 +324,7 @@ fieldset .cptui-help {
325
  -ms-flex: 0 1 auto;
326
  flex: 0 1 auto;
327
  -ms-flex-item-align: auto;
328
- -ms-grid-row-align: auto;
329
  align-self: auto;
330
  }
331
 
@@ -335,7 +334,7 @@ fieldset .cptui-help {
335
  -ms-flex: 0 1 auto;
336
  flex: 0 1 auto;
337
  -ms-flex-item-align: auto;
338
- -ms-grid-row-align: auto;
339
  align-self: auto;
340
  }
341
 
@@ -345,7 +344,7 @@ fieldset .cptui-help {
345
  -ms-flex: 0 1 auto;
346
  flex: 0 1 auto;
347
  -ms-flex-item-align: auto;
348
- -ms-grid-row-align: auto;
349
  align-self: auto;
350
  }
351
 
@@ -354,11 +353,11 @@ fieldset .cptui-help {
354
  }
355
 
356
  .wdspromos-about p:nth-child(1) {
357
- padding-left: 0px;
358
  }
359
 
360
  .wdspromos-about p:nth-child(4) {
361
- padding-right: 0px;
362
  }
363
 
364
  .no-js #cptui_choose_icon {
@@ -415,7 +414,6 @@ fieldset .cptui-help {
415
  .cptui-table td.outer {
416
  width: 100%;
417
  }
418
- #cptui-audit-textarea,
419
  #cptui_debug_info_email {
420
  width: 100%;
421
  }
127
  .cptui_tax_get_code {
128
  height: 300px;
129
  resize: vertical;
 
130
  }
131
 
132
  .about-wrap .cptui-feature {
312
  -ms-flex-pack: justify;
313
  justify-content: space-between;
314
  -ms-flex-line-pack: stretch;
315
+ align-content: stretch;
316
  -ms-flex-align: start;
317
  align-items: flex-start;
318
  margin: 20px 0;
324
  -ms-flex: 0 1 auto;
325
  flex: 0 1 auto;
326
  -ms-flex-item-align: auto;
327
+ -ms-grid-row-align: auto;
328
  align-self: auto;
329
  }
330
 
334
  -ms-flex: 0 1 auto;
335
  flex: 0 1 auto;
336
  -ms-flex-item-align: auto;
337
+ -ms-grid-row-align: auto;
338
  align-self: auto;
339
  }
340
 
344
  -ms-flex: 0 1 auto;
345
  flex: 0 1 auto;
346
  -ms-flex-item-align: auto;
347
+ -ms-grid-row-align: auto;
348
  align-self: auto;
349
  }
350
 
353
  }
354
 
355
  .wdspromos-about p:nth-child(1) {
356
+ padding-left: 0;
357
  }
358
 
359
  .wdspromos-about p:nth-child(4) {
360
+ padding-right: 0;
361
  }
362
 
363
  .no-js #cptui_choose_icon {
414
  .cptui-table td.outer {
415
  width: 100%;
416
  }
 
417
  #cptui_debug_info_email {
418
  width: 100%;
419
  }
css/cptui.min.css CHANGED
@@ -1 +1 @@
1
- .posttypesui,.taxonomiesui{width:calc(100% - 300px)}.posttypesui .cptui-section:first-child,.taxonomiesui .cptui-section:first-child{margin-top:30px}.posttypesui .postbox-container,.taxonomiesui .postbox-container{width:100%}.posttypesui .postbox .toggle-indicator:before,.taxonomiesui .postbox .toggle-indicator:before{content:"\f142";display:inline-block;font:normal 20px/1 dashicons;speak:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-decoration:none!important}.posttypesui .postbox.closed .handlediv .toggle-indicator:before,.taxonomiesui .postbox.closed .handlediv .toggle-indicator:before{content:"\f140"}.posttypesui .postbox .hndle,.taxonomiesui .postbox .hndle{cursor:pointer}.posttypesui .required,.taxonomiesui .required{color:red}.cptui-table #excerpt{display:inline-block;height:16px;margin:12px 4px 12px 0;width:auto}.cptui-table td.outer{vertical-align:top;width:50%}.cptui-edit .cptui-table textarea,.cptui-new .cptui-table textarea,.cptui-table input[type=text]{width:75%}.cptui-table .question:hover{cursor:pointer}.cptui-table th p{font-weight:400;font-size:12px}.cptui-table .cptui-slug-details{margin-top:15px}.cptui-table #slugchanged,.cptui-table #slugexists{color:red;font-weight:700}.cptui-table #slugchanged.hidemessage,.cptui-table #slugexists.hidemessage{display:none}.cpt-ui_page_cptui_tools .cptui-table .outer p{padding:0 4px}.cptui-support #support .question{font-size:18px;font-weight:700}.cptui-support #support .question:before{content:"\f139";display:inline-block;font:normal 25px/1 dashicons;margin-left:-25px;position:absolute;-webkit-font-smoothing:antialiased}.cptui-support #support .question.active:before{content:"\f140"}.cptui-support #support .answer{margin:10px 0 0 20px}.cptui-support #support ol li{list-style:none}.cptui-support #support li{position:relative}.cptui-field-description{font-style:italic}#cptui_select_post_type,#cptui_select_taxonomy{margin-top:15px}.cptui_post_import,.cptui_tax_import{height:200px;margin-bottom:10px;resize:vertical;width:100%}.cptui_post_type_get_code,.cptui_tax_get_code{height:300px;resize:vertical;width:100%}.about-wrap .cptui-feature{overflow:visible!important;*zoom:1}.about-wrap .cptui-feature:after,.about-wrap .cptui-feature:before{content:" ";display:table}.about-wrap .cptui-feature:after{clear:both}.about-wrap h3+.cptui-feature{margin-top:0}.about-wrap .changelog h2{text-align:center}.about-wrap .feature-rest div{width:50%!important;padding-right:100px;box-sizing:border-box;margin:0!important}.about-wrap .feature-rest div.last-feature{padding-left:100px;padding-right:0}.about-wrap .feature-rest div.icon{width:0!important;padding:0;margin:0}.about-wrap .feature-rest div.icon:before{font-weight:400;width:100%;font-size:170px;line-height:125px;color:#9c5d90;display:inline-block;position:relative;text-align:center;speak:none;margin:0 0 0 -100px;content:"\e01d";-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.rtl .about-wrap .feature-rest div{padding-left:100px}.rtl .about-wrap .feature-rest div.last-feature{padding-right:100px;padding-left:0}.rtl .about-wrap .feature-rest div.icon:before{margin:0 -100px 0 0}.about-wrap .about-integrations{background:#fff;margin:20px 0;padding:1px 20px 10px}.about-wrap .changelog h4{line-height:1.4}.about-wrap .cptui-about-text{margin-bottom:1em!important}.about-wrap .cptui-badge{position:absolute;top:0;right:0}#togglelabels{display:none}.js #togglelabels{display:inline-block}.cptui-help{color:#424242;margin-left:4px;opacity:.5;text-decoration:none;width:16px}fieldset .cptui-help{position:relative;top:4px}.cptui-help:hover{color:#0074a2;opacity:1}.cptui-help:focus{box-shadow:none}#toplevel_page_cptui_main_menu img{height:20px;margin-top:-2px;width:20px}.visuallyhidden{position:absolute;left:-10000px;top:auto;width:1px;height:1px;overflow:hidden}.cptui-section fieldset{border:1px solid #ccc;display:block;margin-bottom:30px;padding:10px;overflow:hidden}.js .cptui-section fieldset.toggledclosed{height:1px}.cptui-section legend{border:1px solid #ccc;border-bottom:0;font-size:14px;font-weight:700;padding:5px}.cptui-spacer{display:block;margin-top:25px}.wdspromos{float:right;margin-left:20px;margin-top:10px;width:275px}.wdspromos #mc_embed_signup{background:#fff;border:1px solid #ccc;clear:left;margin-bottom:10px}.wdspromos-about{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-wrap:nowrap;flex-wrap:nowrap;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-line-pack:stretch;align-content:stretch;-ms-flex-align:start;align-items:flex-start;margin:20px 0}.wdspromos-about a:first-child,.wdspromos-about a:nth-child(2),.wdspromos-about a:nth-child(3){-ms-flex-order:0;order:0;-ms-flex:0 1 auto;flex:0 1 auto;-ms-flex-item-align:auto;-ms-grid-row-align:auto;align-self:auto}.wdspromos-about p{padding:0 5px}.wdspromos-about p:first-child{padding-left:0}.wdspromos-about p:nth-child(4){padding-right:0}.no-js #cptui_choose_icon{display:none}.cptui-listings th{font-weight:700}.cptui-listings .post-type-listing th{width:16.66667%}.cptui-listings .taxonomy-listing th{width:20%}#poststuff{min-width:463px}@media screen and (min-width:769px){.cptui-badge{padding-top:142px;height:50px;width:173px;color:#fafafa;font-weight:700;font-size:14px;text-align:center;margin:0 -5px;background:url(../images/cptui-icon-173x173.png) no-repeat}}@media screen and (max-width:768px){.cptui-table #description{width:100%}.wdspromos-about{-ms-flex-wrap:wrap;flex-wrap:wrap}.wdspromos-about p{margin:5px auto}.wdspromos-about p:first-child{padding-left:5px}.wdspromos-about p:nth-child(4){padding-right:5px}#cptui-audit-textarea,#cptui_debug_info_email,.cptui-table td.outer{width:100%}}
1
+ .posttypesui,.taxonomiesui{width:calc(100% - 300px)}.posttypesui .cptui-section:first-child,.taxonomiesui .cptui-section:first-child{margin-top:30px}.posttypesui .postbox-container,.taxonomiesui .postbox-container{width:100%}.posttypesui .postbox .toggle-indicator:before,.taxonomiesui .postbox .toggle-indicator:before{content:"\f142";display:inline-block;font:normal 20px/1 dashicons;speak:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-decoration:none!important}.posttypesui .postbox.closed .handlediv .toggle-indicator:before,.taxonomiesui .postbox.closed .handlediv .toggle-indicator:before{content:"\f140"}.posttypesui .postbox .hndle,.taxonomiesui .postbox .hndle{cursor:pointer}.posttypesui .required,.taxonomiesui .required{color:red}.cptui-table #excerpt{display:inline-block;height:16px;margin:12px 4px 12px 0;width:auto}.cptui-table td.outer{vertical-align:top;width:50%}.cptui-edit .cptui-table textarea,.cptui-new .cptui-table textarea,.cptui-table input[type=text]{width:75%}.cptui-table .question:hover{cursor:pointer}.cptui-table th p{font-weight:400;font-size:12px}.cptui-table .cptui-slug-details{margin-top:15px}.cptui-table #slugchanged,.cptui-table #slugexists{color:red;font-weight:700}.cptui-table #slugchanged.hidemessage,.cptui-table #slugexists.hidemessage{display:none}.cpt-ui_page_cptui_tools .cptui-table .outer p{padding:0 4px}.cptui-support #support .question{font-size:18px;font-weight:700}.cptui-support #support .question:before{content:"\f139";display:inline-block;font:normal 25px/1 dashicons;margin-left:-25px;position:absolute;-webkit-font-smoothing:antialiased}.cptui-support #support .question.active:before{content:"\f140"}.cptui-support #support .answer{margin:10px 0 0 20px}.cptui-support #support ol li{list-style:none}.cptui-support #support li{position:relative}.cptui-field-description{font-style:italic}#cptui_select_post_type,#cptui_select_taxonomy{margin-top:15px}.cptui_post_import,.cptui_tax_import{height:200px;margin-bottom:10px;resize:vertical;width:100%}.cptui_post_type_get_code,.cptui_tax_get_code{height:300px;resize:vertical}.about-wrap .cptui-feature{overflow:visible!important;*zoom:1}.about-wrap .cptui-feature:after,.about-wrap .cptui-feature:before{content:" ";display:table}.about-wrap .cptui-feature:after{clear:both}.about-wrap h3+.cptui-feature{margin-top:0}.about-wrap .changelog h2{text-align:center}.about-wrap .feature-rest div{width:50%!important;padding-right:100px;box-sizing:border-box;margin:0!important}.about-wrap .feature-rest div.last-feature{padding-left:100px;padding-right:0}.about-wrap .feature-rest div.icon{width:0!important;padding:0;margin:0}.about-wrap .feature-rest div.icon:before{font-weight:400;width:100%;font-size:170px;line-height:125px;color:#9c5d90;display:inline-block;position:relative;text-align:center;speak:none;margin:0 0 0 -100px;content:"\e01d";-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.rtl .about-wrap .feature-rest div{padding-left:100px}.rtl .about-wrap .feature-rest div.last-feature{padding-right:100px;padding-left:0}.rtl .about-wrap .feature-rest div.icon:before{margin:0 -100px 0 0}.about-wrap .about-integrations{background:#fff;margin:20px 0;padding:1px 20px 10px}.about-wrap .changelog h4{line-height:1.4}.about-wrap .cptui-about-text{margin-bottom:1em!important}.about-wrap .cptui-badge{position:absolute;top:0;right:0}#togglelabels{display:none}.js #togglelabels{display:inline-block}.cptui-help{color:#424242;margin-left:4px;opacity:.5;text-decoration:none;width:16px}fieldset .cptui-help{position:relative;top:4px}.cptui-help:hover{color:#0074a2;opacity:1}.cptui-help:focus{box-shadow:none}#toplevel_page_cptui_main_menu img{height:20px;margin-top:-2px;width:20px}.visuallyhidden{position:absolute;left:-10000px;top:auto;width:1px;height:1px;overflow:hidden}.cptui-section fieldset{border:1px solid #ccc;display:block;margin-bottom:30px;padding:10px;overflow:hidden}.js .cptui-section fieldset.toggledclosed{height:1px}.cptui-section legend{border:1px solid #ccc;border-bottom:0;font-size:14px;font-weight:700;padding:5px}.cptui-spacer{display:block;margin-top:25px}.wdspromos{float:right;margin-left:20px;margin-top:10px;width:275px}.wdspromos #mc_embed_signup{background:#fff;border:1px solid #ccc;clear:left;margin-bottom:10px}.wdspromos-about{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-wrap:nowrap;flex-wrap:nowrap;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-line-pack:stretch;align-content:stretch;-ms-flex-align:start;align-items:flex-start;margin:20px 0}.wdspromos-about a:first-child,.wdspromos-about a:nth-child(2),.wdspromos-about a:nth-child(3){-ms-flex-order:0;order:0;-ms-flex:0 1 auto;flex:0 1 auto;-ms-flex-item-align:auto;-ms-grid-row-align:auto;align-self:auto}.wdspromos-about p{padding:0 5px}.wdspromos-about p:first-child{padding-left:0}.wdspromos-about p:nth-child(4){padding-right:0}.no-js #cptui_choose_icon{display:none}.cptui-listings th{font-weight:700}.cptui-listings .post-type-listing th{width:16.66667%}.cptui-listings .taxonomy-listing th{width:20%}#poststuff{min-width:463px}@media screen and (min-width:769px){.cptui-badge{padding-top:142px;height:50px;width:173px;color:#fafafa;font-weight:700;font-size:14px;text-align:center;margin:0 -5px;background:url(../images/cptui-icon-173x173.png) no-repeat}}@media screen and (max-width:768px){.cptui-table #description{width:100%}.wdspromos-about{-ms-flex-wrap:wrap;flex-wrap:wrap}.wdspromos-about p{margin:5px auto}.wdspromos-about p:first-child{padding-left:5px}.wdspromos-about p:nth-child(4){padding-right:5px}#cptui_debug_info_email,.cptui-table td.outer{width:100%}}
css/cptui.scss CHANGED
@@ -117,7 +117,6 @@ $max-tablet: "screen and (max-width: 768px)";
117
  .cptui_tax_get_code {
118
  height: 300px;
119
  resize: vertical;
120
- width: 100%;
121
  }
122
  .about-wrap {
123
  .cptui-feature {
@@ -297,7 +296,6 @@ $max-tablet: "screen and (max-width: 768px)";
297
  -ms-flex-pack: justify;
298
  justify-content: space-between;
299
  -webkit-align-content: stretch;
300
- -ms-flex-line-pack: stretch;
301
  align-content: stretch;
302
  -webkit-align-items: flex-start;
303
  -ms-flex-align: start;
@@ -305,47 +303,41 @@ $max-tablet: "screen and (max-width: 768px)";
305
  margin: 20px 0;
306
 
307
  a:nth-child(1) {
308
- -webkit-order: 0;
309
  -ms-flex-order: 0;
310
  order: 0;
311
  -webkit-flex: 0 1 auto;
312
  -ms-flex: 0 1 auto;
313
  flex: 0 1 auto;
314
  -webkit-align-self: auto;
315
- -ms-flex-item-align: auto;
316
  align-self: auto;
317
  }
318
 
319
  a:nth-child(2) {
320
- -webkit-order: 0;
321
  -ms-flex-order: 0;
322
  order: 0;
323
  -webkit-flex: 0 1 auto;
324
  -ms-flex: 0 1 auto;
325
  flex: 0 1 auto;
326
  -webkit-align-self: auto;
327
- -ms-flex-item-align: auto;
328
  align-self: auto;
329
  }
330
 
331
  a:nth-child(3) {
332
- -webkit-order: 0;
333
  -ms-flex-order: 0;
334
  order: 0;
335
  -webkit-flex: 0 1 auto;
336
  -ms-flex: 0 1 auto;
337
  flex: 0 1 auto;
338
  -webkit-align-self: auto;
339
- -ms-flex-item-align: auto;
340
  align-self: auto;
341
  }
342
  p {
343
  padding: 0 5px;
344
  &:nth-child(1) {
345
- padding-left: 0px;
346
  }
347
  &:nth-child(4) {
348
- padding-right: 0px;
349
  }
350
  }
351
  }
@@ -410,7 +402,7 @@ $max-tablet: "screen and (max-width: 768px)";
410
  width: 100%;
411
  }
412
  }
413
- #cptui-audit-textarea,
414
  #cptui_debug_info_email {
415
  width: 100%;
416
  }
117
  .cptui_tax_get_code {
118
  height: 300px;
119
  resize: vertical;
 
120
  }
121
  .about-wrap {
122
  .cptui-feature {
296
  -ms-flex-pack: justify;
297
  justify-content: space-between;
298
  -webkit-align-content: stretch;
 
299
  align-content: stretch;
300
  -webkit-align-items: flex-start;
301
  -ms-flex-align: start;
303
  margin: 20px 0;
304
 
305
  a:nth-child(1) {
 
306
  -ms-flex-order: 0;
307
  order: 0;
308
  -webkit-flex: 0 1 auto;
309
  -ms-flex: 0 1 auto;
310
  flex: 0 1 auto;
311
  -webkit-align-self: auto;
 
312
  align-self: auto;
313
  }
314
 
315
  a:nth-child(2) {
 
316
  -ms-flex-order: 0;
317
  order: 0;
318
  -webkit-flex: 0 1 auto;
319
  -ms-flex: 0 1 auto;
320
  flex: 0 1 auto;
321
  -webkit-align-self: auto;
 
322
  align-self: auto;
323
  }
324
 
325
  a:nth-child(3) {
 
326
  -ms-flex-order: 0;
327
  order: 0;
328
  -webkit-flex: 0 1 auto;
329
  -ms-flex: 0 1 auto;
330
  flex: 0 1 auto;
331
  -webkit-align-self: auto;
 
332
  align-self: auto;
333
  }
334
  p {
335
  padding: 0 5px;
336
  &:nth-child(1) {
337
+ padding-left: 0;
338
  }
339
  &:nth-child(4) {
340
+ padding-right: 0;
341
  }
342
  }
343
  }
402
  width: 100%;
403
  }
404
  }
405
+
406
  #cptui_debug_info_email {
407
  width: 100%;
408
  }
custom-post-type-ui.php CHANGED
@@ -11,25 +11,27 @@
11
  * @license GPL-2.0+
12
  */
13
 
14
- /*
15
- Plugin Name: Custom Post Type UI
16
- Plugin URI: https://github.com/WebDevStudios/custom-post-type-ui/
17
- Description: Admin panel for creating custom post types and custom taxonomies in WordPress
18
- Author: WebDevStudios
19
- Version: 1.6.2
20
- Author URI: https://webdevstudios.com/
21
- Text Domain: custom-post-type-ui
22
- Domain Path: /languages
23
- License: GPL-2.0+
24
- */
 
 
25
 
26
  // Exit if accessed directly.
27
  if ( ! defined( 'ABSPATH' ) ) {
28
  exit;
29
  }
30
 
31
- define( 'CPT_VERSION', '1.6.2' ); // Left for legacy purposes.
32
- define( 'CPTUI_VERSION', '1.6.2' );
33
  define( 'CPTUI_WP_VERSION', get_bloginfo( 'version' ) );
34
 
35
  /**
@@ -40,8 +42,8 @@ define( 'CPTUI_WP_VERSION', get_bloginfo( 'version' ) );
40
  * @internal
41
  */
42
  function cptui_load_ui_class() {
43
- require_once( plugin_dir_path( __FILE__ ) . 'classes/class.cptui_admin_ui.php' );
44
- require_once( plugin_dir_path( __FILE__ ) . 'classes/class.cptui_debug_info.php' );
45
  }
46
  add_action( 'init', 'cptui_load_ui_class' );
47
 
@@ -86,7 +88,7 @@ function cptui_make_activation_redirect() {
86
  // Redirect to CPTUI about page.
87
  wp_safe_redirect(
88
  add_query_arg(
89
- array( 'page' => 'cptui_main_menu' ),
90
  cptui_admin_url( 'admin.php?page=cptui_main_menu' )
91
  )
92
  );
@@ -189,16 +191,16 @@ add_action( 'plugins_loaded', 'cptui_loaded' );
189
  * @internal
190
  */
191
  function cptui_create_submenus() {
192
- require_once( plugin_dir_path( __FILE__ ) . 'inc/about.php' );
193
- require_once( plugin_dir_path( __FILE__ ) . 'inc/utility.php' );
194
- require_once( plugin_dir_path( __FILE__ ) . 'inc/post-types.php' );
195
- require_once( plugin_dir_path( __FILE__ ) . 'inc/taxonomies.php' );
196
- require_once( plugin_dir_path( __FILE__ ) . 'inc/listings.php' );
197
- require_once( plugin_dir_path( __FILE__ ) . 'inc/tools.php' );
198
- require_once( plugin_dir_path( __FILE__ ) . 'inc/support.php' );
199
 
200
  if ( defined( 'WP_CLI' ) && WP_CLI ) {
201
- require_once( plugin_dir_path( __FILE__ ) . 'inc/wp-cli.php' );
202
  }
203
  }
204
  add_action( 'cptui_loaded', 'cptui_create_submenus' );
@@ -234,8 +236,8 @@ function cptui_add_styles() {
234
  }
235
 
236
  $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
237
- wp_register_script( 'cptui', plugins_url( "js/cptui{$min}.js", __FILE__ ), array( 'jquery', 'postbox' ), CPTUI_VERSION, true );
238
- wp_register_style( 'cptui-css', plugins_url( "css/cptui{$min}.css", __FILE__ ), array(), CPTUI_VERSION );
239
  }
240
  add_action( 'admin_enqueue_scripts', 'cptui_add_styles' );
241
 
@@ -264,6 +266,33 @@ function cptui_create_custom_post_types() {
264
 
265
  if ( is_array( $cpts ) ) {
266
  foreach ( $cpts as $post_type ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
267
  cptui_register_single_post_type( $post_type );
268
  }
269
  }
@@ -289,7 +318,7 @@ add_action( 'init', 'cptui_create_custom_post_types', 10 ); // Leave on standard
289
  * @param array $post_type Post type array to register. Optional.
290
  * @return null Result of register_post_type.
291
  */
292
- function cptui_register_single_post_type( $post_type = array() ) {
293
 
294
  /**
295
  * Filters the map_meta_cap value.
@@ -303,7 +332,7 @@ function cptui_register_single_post_type( $post_type = array() ) {
303
  $post_type['map_meta_cap'] = apply_filters( 'cptui_map_meta_cap', true, $post_type['name'], $post_type );
304
 
305
  if ( empty( $post_type['supports'] ) ) {
306
- $post_type['supports'] = array();
307
  }
308
 
309
  /**
@@ -315,13 +344,13 @@ function cptui_register_single_post_type( $post_type = array() ) {
315
  * @param string $name Post type slug being registered.
316
  * @param array $post_type Array of post type arguments to be registered.
317
  */
318
- $user_supports_params = apply_filters( 'cptui_user_supports_params', array(), $post_type['name'], $post_type );
319
 
320
  if ( is_array( $user_supports_params ) && ! empty( $user_supports_params ) ) {
321
  if ( is_array( $post_type['supports'] ) ) {
322
  $post_type['supports'] = array_merge( $post_type['supports'], $user_supports_params );
323
  } else {
324
- $post_type['supports'] = array( $user_supports_params );
325
  }
326
  }
327
 
@@ -330,7 +359,7 @@ function cptui_register_single_post_type( $post_type = array() ) {
330
  $custom = explode( ',', $post_type['custom_supports'] );
331
  foreach ( $custom as $part ) {
332
  // We'll handle YARPP separately.
333
- if ( in_array( $part, array( 'YARPP', 'yarpp' ) ) ) {
334
  $yarpp = true;
335
  continue;
336
  }
@@ -338,16 +367,16 @@ function cptui_register_single_post_type( $post_type = array() ) {
338
  }
339
  }
340
 
341
- if ( isset( $post_type['supports'] ) && is_array( $post_type['supports'] ) && in_array( 'none', $post_type['supports'] ) ) {
342
  $post_type['supports'] = false;
343
  }
344
 
345
- $labels = array(
346
  'name' => $post_type['label'],
347
  'singular_name' => $post_type['singular_label'],
348
- );
349
 
350
- $preserved = cptui_get_preserved_keys( 'post_types' );
351
  $preserved_labels = cptui_get_preserved_labels();
352
  foreach ( $post_type['labels'] as $key => $label ) {
353
 
@@ -357,14 +386,14 @@ function cptui_register_single_post_type( $post_type = array() ) {
357
  } else {
358
  $labels[ $key ] = $label;
359
  }
360
- } elseif ( empty( $label ) && in_array( $key, $preserved ) ) {
361
  $singular_or_plural = ( in_array( $key, array_keys( $preserved_labels['post_types']['plural'] ) ) ) ? 'plural' : 'singular';
362
- $label_plurality = ( 'plural' === $singular_or_plural ) ? $post_type['label'] : $post_type['singular_label'];
363
- $labels[ $key ] = sprintf( $preserved_labels['post_types'][ $singular_or_plural ][ $key ], $label_plurality );
364
  }
365
  }
366
 
367
- $has_archive = ( isset( $post_type['has_archive'] ) ) ? get_disp_boolean( $post_type['has_archive'] ) : false;
368
  if ( $has_archive && ! empty( $post_type['has_archive_string'] ) ) {
369
  $has_archive = $post_type['has_archive_string'];
370
  }
@@ -377,18 +406,18 @@ function cptui_register_single_post_type( $post_type = array() ) {
377
  $rewrite = get_disp_boolean( $post_type['rewrite'] );
378
  if ( false !== $rewrite ) {
379
  // Core converts to an empty array anyway, so safe to leave this instead of passing in boolean true.
380
- $rewrite = array();
381
- $rewrite['slug'] = ( ! empty( $post_type['rewrite_slug'] ) ) ? $post_type['rewrite_slug'] : $post_type['name'];
382
 
383
  $rewrite['with_front'] = true; // Default value.
384
  if ( isset( $post_type['rewrite_withfront'] ) ) {
385
- $rewrite['with_front'] = ( 'false' === disp_boolean( $post_type['rewrite_withfront'] ) ) ? false : true;
386
  }
387
  }
388
 
389
- $menu_icon = ( ! empty( $post_type['menu_icon'] ) ) ? $post_type['menu_icon'] : null;
390
 
391
- if ( in_array( $post_type['query_var'], array( 'true', 'false', '0', '1' ) ) ) {
392
  $post_type['query_var'] = get_disp_boolean( $post_type['query_var'] );
393
  }
394
  if ( ! empty( $post_type['query_var_slug'] ) ) {
@@ -400,6 +429,11 @@ function cptui_register_single_post_type( $post_type = array() ) {
400
  $menu_position = (int) $post_type['menu_position'];
401
  }
402
 
 
 
 
 
 
403
  $capability_type = 'post';
404
  if ( ! empty( $post_type['capability_type'] ) ) {
405
  $capability_type = $post_type['capability_type'];
@@ -416,7 +450,7 @@ function cptui_register_single_post_type( $post_type = array() ) {
416
  if ( ! empty( $post_type['exclude_from_search'] ) ) {
417
  $exclude_from_search = get_disp_boolean( $post_type['exclude_from_search'] );
418
  } else {
419
- $exclude_from_search = ( false === $public ) ? true : false;
420
  }
421
 
422
  $queryable = ( ! empty( $post_type['publicly_queryable'] ) && isset( $post_type['publicly_queryable'] ) ) ? get_disp_boolean( $post_type['publicly_queryable'] ) : $public;
@@ -440,7 +474,7 @@ function cptui_register_single_post_type( $post_type = array() ) {
440
  $rest_controller_class = $post_type['rest_controller_class'];
441
  }
442
 
443
- $args = array(
444
  'labels' => $labels,
445
  'description' => $post_type['description'],
446
  'public' => get_disp_boolean( $post_type['public'] ),
@@ -449,6 +483,7 @@ function cptui_register_single_post_type( $post_type = array() ) {
449
  'show_in_nav_menus' => get_disp_boolean( $post_type['show_in_nav_menus'] ),
450
  'has_archive' => $has_archive,
451
  'show_in_menu' => $show_in_menu,
 
452
  'show_in_rest' => get_disp_boolean( $post_type['show_in_rest'] ),
453
  'rest_base' => $rest_base,
454
  'rest_controller_class' => $rest_controller_class,
@@ -462,7 +497,7 @@ function cptui_register_single_post_type( $post_type = array() ) {
462
  'query_var' => $post_type['query_var'],
463
  'supports' => $post_type['supports'],
464
  'taxonomies' => $post_type['taxonomies'],
465
- );
466
 
467
  if ( true === $yarpp ) {
468
  $args['yarpp_support'] = $yarpp;
@@ -508,6 +543,32 @@ function cptui_create_custom_taxonomies() {
508
 
509
  if ( is_array( $taxes ) ) {
510
  foreach ( $taxes as $tax ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
511
  cptui_register_single_taxonomy( $tax );
512
  }
513
  }
@@ -533,35 +594,35 @@ add_action( 'init', 'cptui_create_custom_taxonomies', 9 ); // Leave on standard
533
  * @param array $taxonomy Taxonomy array to register. Optional.
534
  * @return null Result of register_taxonomy.
535
  */
536
- function cptui_register_single_taxonomy( $taxonomy = array() ) {
537
 
538
- $labels = array(
539
- 'name' => $taxonomy['label'],
540
- 'singular_name' => $taxonomy['singular_label'],
541
- );
542
 
543
  $description = '';
544
  if ( ! empty( $taxonomy['description'] ) ) {
545
  $description = $taxonomy['description'];
546
  }
547
 
548
- $preserved = cptui_get_preserved_keys( 'taxonomies' );
549
  $preserved_labels = cptui_get_preserved_labels();
550
  foreach ( $taxonomy['labels'] as $key => $label ) {
551
 
552
  if ( ! empty( $label ) ) {
553
  $labels[ $key ] = $label;
554
- } elseif ( empty( $label ) && in_array( $key, $preserved ) ) {
555
  $singular_or_plural = ( in_array( $key, array_keys( $preserved_labels['taxonomies']['plural'] ) ) ) ? 'plural' : 'singular';
556
- $label_plurality = ( 'plural' === $singular_or_plural ) ? $taxonomy['label'] : $taxonomy['singular_label'];
557
- $labels[ $key ] = sprintf( $preserved_labels['taxonomies'][ $singular_or_plural ][ $key ], $label_plurality );
558
  }
559
  }
560
 
561
  $rewrite = get_disp_boolean( $taxonomy['rewrite'] );
562
  if ( false !== get_disp_boolean( $taxonomy['rewrite'] ) ) {
563
- $rewrite = array();
564
- $rewrite['slug'] = ( ! empty( $taxonomy['rewrite_slug'] ) ) ? $taxonomy['rewrite_slug'] : $taxonomy['name'];
565
  $rewrite['with_front'] = true;
566
  if ( isset( $taxonomy['rewrite_withfront'] ) ) {
567
  $rewrite['with_front'] = ( 'false' === disp_boolean( $taxonomy['rewrite_withfront'] ) ) ? false : true;
@@ -572,7 +633,7 @@ function cptui_register_single_taxonomy( $taxonomy = array() ) {
572
  }
573
  }
574
 
575
- if ( in_array( $taxonomy['query_var'], array( 'true', 'false', '0', '1' ) ) ) {
576
  $taxonomy['query_var'] = get_disp_boolean( $taxonomy['query_var'] );
577
  }
578
  if ( true === $taxonomy['query_var'] && ! empty( $taxonomy['query_var_slug'] ) ) {
@@ -617,7 +678,7 @@ function cptui_register_single_taxonomy( $taxonomy = array() ) {
617
  $meta_box_cb = ( false !== get_disp_boolean( $taxonomy['meta_box_cb'] ) ) ? $taxonomy['meta_box_cb'] : false;
618
  }
619
 
620
- $args = array(
621
  'labels' => $labels,
622
  'label' => $taxonomy['label'],
623
  'description' => $description,
@@ -635,9 +696,9 @@ function cptui_register_single_taxonomy( $taxonomy = array() ) {
635
  'rest_controller_class' => $rest_controller_class,
636
  'show_in_quick_edit' => $show_in_quick_edit,
637
  'meta_box_cb' => $meta_box_cb,
638
- );
639
 
640
- $object_type = ( ! empty( $taxonomy['object_types'] ) ) ? $taxonomy['object_types'] : '';
641
 
642
  /**
643
  * Filters the arguments used for a taxonomy right before registering.
@@ -662,6 +723,7 @@ function cptui_register_single_taxonomy( $taxonomy = array() ) {
662
  * @since 1.0.0
663
  *
664
  * @param string $page Whether it's the CPT or Taxonomy page. Optional. Default "post_types".
 
665
  */
666
  function cptui_settings_tab_menu( $page = 'post_types' ) {
667
 
@@ -673,17 +735,17 @@ function cptui_settings_tab_menu( $page = 'post_types' ) {
673
  * @param array $value Array of tabs to render.
674
  * @param string $page Current page being displayed.
675
  */
676
- $tabs = (array) apply_filters( 'cptui_get_tabs', array(), $page );
677
 
678
- if ( ! empty( $tabs['page_title'] ) ) {
679
- printf(
680
- '<h1>%s</h1><h2 class="nav-tab-wrapper">',
681
- $tabs['page_title']
682
- );
683
  }
684
 
 
 
 
685
  foreach ( $tabs['tabs'] as $tab ) {
686
- printf(
687
  '<a class="%s" href="%s" aria-selected="%s">%s</a>',
688
  implode( ' ', $tab['classes'] ),
689
  $tab['url'],
@@ -692,7 +754,11 @@ function cptui_settings_tab_menu( $page = 'post_types' ) {
692
  );
693
  }
694
 
695
- echo '</h2>';
 
 
 
 
696
  }
697
 
698
  /**
@@ -716,12 +782,12 @@ function cptui_convert_settings() {
716
 
717
  if ( false === get_option( 'cptui_post_types' ) && ( $post_types = get_option( 'cpt_custom_post_types' ) ) ) {
718
 
719
- $new_post_types = array();
720
  foreach ( $post_types as $type ) {
721
- $new_post_types[ $type['name'] ] = $type; // This one assigns the # indexes. Named arrays are our friend.
722
- $new_post_types[ $type['name'] ]['supports'] = ( ! empty( $type[0] ) ) ? $type[0] : array(); // Especially for multidimensional arrays.
723
- $new_post_types[ $type['name'] ]['taxonomies'] = ( ! empty( $type[1] ) ) ? $type[1] : array();
724
- $new_post_types[ $type['name'] ]['labels'] = ( ! empty( $type[2] ) ) ? $type[2] : array();
725
  unset(
726
  $new_post_types[ $type['name'] ][0],
727
  $new_post_types[ $type['name'] ][1],
@@ -734,10 +800,10 @@ function cptui_convert_settings() {
734
 
735
  if ( false === get_option( 'cptui_taxonomies' ) && ( $taxonomies = get_option( 'cpt_custom_tax_types' ) ) ) {
736
 
737
- $new_taxonomies = array();
738
  foreach ( $taxonomies as $tax ) {
739
  $new_taxonomies[ $tax['name'] ] = $tax; // Yep, still our friend.
740
- $new_taxonomies[ $tax['name'] ]['labels'] = $tax[0]; // Taxonomies are the only thing with
741
  $new_taxonomies[ $tax['name'] ]['object_types'] = $tax[1]; // "tax" in the name that I like.
742
  unset(
743
  $new_taxonomies[ $tax['name'] ][0],
@@ -769,9 +835,9 @@ add_action( 'admin_init', 'cptui_convert_settings' );
769
  */
770
  function cptui_admin_notices( $action = '', $object_type = '', $success = true, $custom = '' ) {
771
 
772
- $class = array();
773
- $class[] = ( $success ) ? 'updated' : 'error';
774
- $class[] = 'notice is-dismissible';
775
  $object_type = esc_attr( $object_type );
776
 
777
  $messagewrapstart = '<div id="message" class="' . implode( ' ', $class ) . '"><p>';
@@ -779,31 +845,31 @@ function cptui_admin_notices( $action = '', $object_type = '', $success = true,
779
 
780
  $messagewrapend = '</p></div>';
781
 
782
- if ( 'add' == $action ) {
783
  if ( $success ) {
784
  $message .= sprintf( __( '%s has been successfully added', 'custom-post-type-ui' ), $object_type );
785
  } else {
786
  $message .= sprintf( __( '%s has failed to be added', 'custom-post-type-ui' ), $object_type );
787
  }
788
- } elseif ( 'update' == $action ) {
789
  if ( $success ) {
790
  $message .= sprintf( __( '%s has been successfully updated', 'custom-post-type-ui' ), $object_type );
791
  } else {
792
  $message .= sprintf( __( '%s has failed to be updated', 'custom-post-type-ui' ), $object_type );
793
  }
794
- } elseif ( 'delete' == $action ) {
795
  if ( $success ) {
796
  $message .= sprintf( __( '%s has been successfully deleted', 'custom-post-type-ui' ), $object_type );
797
  } else {
798
  $message .= sprintf( __( '%s has failed to be deleted', 'custom-post-type-ui' ), $object_type );
799
  }
800
- } elseif ( 'import' == $action ) {
801
  if ( $success ) {
802
  $message .= sprintf( __( '%s has been successfully imported', 'custom-post-type-ui' ), $object_type );
803
  } else {
804
  $message .= sprintf( __( '%s has failed to be imported', 'custom-post-type-ui' ), $object_type );
805
  }
806
- } elseif ( 'error' == $action ) {
807
  if ( ! empty( $custom ) ) {
808
  $message = $custom;
809
  }
@@ -838,18 +904,19 @@ function cptui_admin_notices( $action = '', $object_type = '', $success = true,
838
  */
839
  function cptui_get_preserved_keys( $type = '' ) {
840
 
841
- $preserved_labels = array(
842
- 'post_types' => array(
843
  'add_new_item',
844
  'edit_item',
845
  'new_item',
846
  'view_item',
 
847
  'all_items',
848
  'search_items',
849
  'not_found',
850
  'not_found_in_trash',
851
- ),
852
- 'taxonomies' => array(
853
  'search_items',
854
  'popular_items',
855
  'all_items',
@@ -862,9 +929,9 @@ function cptui_get_preserved_keys( $type = '' ) {
862
  'separate_items_with_commas',
863
  'add_or_remove_items',
864
  'choose_from_most_used',
865
- ),
866
- );
867
- return ( ! empty( $type ) ) ? $preserved_labels[ $type ] : array();
868
  }
869
 
870
  /**
@@ -882,18 +949,19 @@ function cptui_get_preserved_keys( $type = '' ) {
882
  */
883
  function cptui_get_preserved_label( $type = '', $key = '', $plural = '', $singular = '' ) {
884
 
885
- $preserved_labels = array(
886
- 'post_types' => array(
887
  'add_new_item' => sprintf( __( 'Add new %s', 'custom-post-type-ui' ), $singular ),
888
  'edit_item' => sprintf( __( 'Edit %s', 'custom-post-type-ui' ), $singular ),
889
  'new_item' => sprintf( __( 'New %s', 'custom-post-type-ui' ), $singular ),
890
  'view_item' => sprintf( __( 'View %s', 'custom-post-type-ui' ), $singular ),
 
891
  'all_items' => sprintf( __( 'All %s', 'custom-post-type-ui' ), $plural ),
892
  'search_items' => sprintf( __( 'Search %s', 'custom-post-type-ui' ), $plural ),
893
  'not_found' => sprintf( __( 'No %s found.', 'custom-post-type-ui' ), $plural ),
894
  'not_found_in_trash' => sprintf( __( 'No %s found in trash.', 'custom-post-type-ui' ), $plural ),
895
- ),
896
- 'taxonomies' => array(
897
  'search_items' => sprintf( __( 'Search %s', 'custom-post-type-ui' ), $plural ),
898
  'popular_items' => sprintf( __( 'Popular %s', 'custom-post-type-ui' ), $plural ),
899
  'all_items' => sprintf( __( 'All %s', 'custom-post-type-ui' ), $plural ),
@@ -906,8 +974,8 @@ function cptui_get_preserved_label( $type = '', $key = '', $plural = '', $singul
906
  'separate_items_with_commas' => sprintf( __( 'Separate %s with commas', 'custom-post-type-ui' ), $plural ),
907
  'add_or_remove_items' => sprintf( __( 'Add or remove %s', 'custom-post-type-ui' ), $plural ),
908
  'choose_from_most_used' => sprintf( __( 'Choose from the most used %s', 'custom-post-type-ui' ), $plural ),
909
- ),
910
- );
911
 
912
  return $preserved_labels[ $type ][ $key ];
913
  }
@@ -922,38 +990,39 @@ function cptui_get_preserved_label( $type = '', $key = '', $plural = '', $singul
922
  * @return array
923
  */
924
  function cptui_get_preserved_labels() {
925
- return array(
926
- 'post_types' => array(
927
- 'singular' => array(
928
  'add_new_item' => __( 'Add new %s', 'custom-post-type-ui' ),
929
  'edit_item' => __( 'Edit %s', 'custom-post-type-ui' ),
930
  'new_item' => __( 'New %s', 'custom-post-type-ui' ),
931
  'view_item' => __( 'View %s', 'custom-post-type-ui' ),
932
- ),
933
- 'plural' => array(
 
934
  'all_items' => __( 'All %s', 'custom-post-type-ui' ),
935
  'search_items' => __( 'Search %s', 'custom-post-type-ui' ),
936
  'not_found' => __( 'No %s found.', 'custom-post-type-ui' ),
937
  'not_found_in_trash' => __( 'No %s found in trash.', 'custom-post-type-ui' ),
938
- ),
939
- ),
940
- 'taxonomies' => array(
941
- 'singular' => array(
942
  'parent_item' => __( 'Parent %s', 'custom-post-type-ui' ),
943
  'parent_item_colon' => __( 'Parent %s:', 'custom-post-type-ui' ),
944
  'edit_item' => __( 'Edit %s', 'custom-post-type-ui' ),
945
  'update_item' => __( 'Update %s', 'custom-post-type-ui' ),
946
  'add_new_item' => __( 'Add new %s', 'custom-post-type-ui' ),
947
  'new_item_name' => __( 'New %s name', 'custom-post-type-ui' ),
948
- ),
949
- 'plural' => array(
950
  'search_items' => __( 'Search %s', 'custom-post-type-ui' ),
951
  'popular_items' => __( 'Popular %s', 'custom-post-type-ui' ),
952
  'all_items' => __( 'All %s', 'custom-post-type-ui' ),
953
  'separate_items_with_commas' => __( 'Separate %s with commas', 'custom-post-type-ui' ),
954
  'add_or_remove_items' => __( 'Add or remove %s', 'custom-post-type-ui' ),
955
  'choose_from_most_used' => __( 'Choose from the most used %s', 'custom-post-type-ui' ),
956
- )
957
- ),
958
- );
959
  }
11
  * @license GPL-2.0+
12
  */
13
 
14
+ /**
15
+ * Plugin Name: Custom Post Type UI
16
+ * Plugin URI: https://github.com/WebDevStudios/custom-post-type-ui/
17
+ * Description: Admin panel for creating custom post types and custom taxonomies in WordPress
18
+ * Author: WebDevStudios
19
+ * Version: 1.7.0
20
+ * Author URI: https://webdevstudios.com/
21
+ * Text Domain: custom-post-type-ui
22
+ * Domain Path: /languages
23
+ * License: GPL-2.0+
24
+ */
25
+
26
+ // phpcs:disable WebDevStudios.All.RequireAuthor
27
 
28
  // Exit if accessed directly.
29
  if ( ! defined( 'ABSPATH' ) ) {
30
  exit;
31
  }
32
 
33
+ define( 'CPT_VERSION', '1.7.0' ); // Left for legacy purposes.
34
+ define( 'CPTUI_VERSION', '1.7.0' );
35
  define( 'CPTUI_WP_VERSION', get_bloginfo( 'version' ) );
36
 
37
  /**
42
  * @internal
43
  */
44
  function cptui_load_ui_class() {
45
+ require_once plugin_dir_path( __FILE__ ) . 'classes/class.cptui_admin_ui.php';
46
+ require_once plugin_dir_path( __FILE__ ) . 'classes/class.cptui_debug_info.php';
47
  }
48
  add_action( 'init', 'cptui_load_ui_class' );
49
 
88
  // Redirect to CPTUI about page.
89
  wp_safe_redirect(
90
  add_query_arg(
91
+ [ 'page' => 'cptui_main_menu' ],
92
  cptui_admin_url( 'admin.php?page=cptui_main_menu' )
93
  )
94
  );
191
  * @internal
192
  */
193
  function cptui_create_submenus() {
194
+ require_once plugin_dir_path( __FILE__ ) . 'inc/about.php';
195
+ require_once plugin_dir_path( __FILE__ ) . 'inc/utility.php';
196
+ require_once plugin_dir_path( __FILE__ ) . 'inc/post-types.php';
197
+ require_once plugin_dir_path( __FILE__ ) . 'inc/taxonomies.php';
198
+ require_once plugin_dir_path( __FILE__ ) . 'inc/listings.php';
199
+ require_once plugin_dir_path( __FILE__ ) . 'inc/tools.php';
200
+ require_once plugin_dir_path( __FILE__ ) . 'inc/support.php';
201
 
202
  if ( defined( 'WP_CLI' ) && WP_CLI ) {
203
+ require_once plugin_dir_path( __FILE__ ) . 'inc/wp-cli.php';
204
  }
205
  }
206
  add_action( 'cptui_loaded', 'cptui_create_submenus' );
236
  }
237
 
238
  $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
239
+ wp_register_script( 'cptui', plugins_url( "js/cptui{$min}.js", __FILE__ ), [ 'jquery', 'jquery-ui-dialog', 'postbox' ], CPTUI_VERSION, true );
240
+ wp_register_style( 'cptui-css', plugins_url( "css/cptui{$min}.css", __FILE__ ), [ 'wp-jquery-ui-dialog' ], CPTUI_VERSION );
241
  }
242
  add_action( 'admin_enqueue_scripts', 'cptui_add_styles' );
243
 
266
 
267
  if ( is_array( $cpts ) ) {
268
  foreach ( $cpts as $post_type ) {
269
+
270
+ /**
271
+ * Filters whether or not to skip registration of the current iterated post type.
272
+ *
273
+ * Dynamic part of the filter name is the chosen post type slug.
274
+ *
275
+ * @since 1.7.0
276
+ *
277
+ * @param bool $value Whether or not to skip the post type.
278
+ * @param array $post_type Current post type being registered.
279
+ */
280
+ if ( (bool) apply_filters( "cptui_disable_{$post_type['name']}_cpt", false, $post_type ) ) {
281
+ continue;
282
+ }
283
+
284
+ /**
285
+ * Filters whether or not to skip registration of the current iterated post type.
286
+ *
287
+ * @since 1.7.0
288
+ *
289
+ * @param bool $value Whether or not to skip the post type.
290
+ * @param array $post_type Current post type being registered.
291
+ */
292
+ if ( (bool) apply_filters( 'cptui_disable_cpt', false, $post_type ) ) {
293
+ continue;
294
+ }
295
+
296
  cptui_register_single_post_type( $post_type );
297
  }
298
  }
318
  * @param array $post_type Post type array to register. Optional.
319
  * @return null Result of register_post_type.
320
  */
321
+ function cptui_register_single_post_type( $post_type = [] ) {
322
 
323
  /**
324
  * Filters the map_meta_cap value.
332
  $post_type['map_meta_cap'] = apply_filters( 'cptui_map_meta_cap', true, $post_type['name'], $post_type );
333
 
334
  if ( empty( $post_type['supports'] ) ) {
335
+ $post_type['supports'] = [];
336
  }
337
 
338
  /**
344
  * @param string $name Post type slug being registered.
345
  * @param array $post_type Array of post type arguments to be registered.
346
  */
347
+ $user_supports_params = apply_filters( 'cptui_user_supports_params', [], $post_type['name'], $post_type );
348
 
349
  if ( is_array( $user_supports_params ) && ! empty( $user_supports_params ) ) {
350
  if ( is_array( $post_type['supports'] ) ) {
351
  $post_type['supports'] = array_merge( $post_type['supports'], $user_supports_params );
352
  } else {
353
+ $post_type['supports'] = [ $user_supports_params ];
354
  }
355
  }
356
 
359
  $custom = explode( ',', $post_type['custom_supports'] );
360
  foreach ( $custom as $part ) {
361
  // We'll handle YARPP separately.
362
+ if ( in_array( $part, [ 'YARPP', 'yarpp' ], true ) ) {
363
  $yarpp = true;
364
  continue;
365
  }
367
  }
368
  }
369
 
370
+ if ( isset( $post_type['supports'] ) && is_array( $post_type['supports'] ) && in_array( 'none', $post_type['supports'], true ) ) {
371
  $post_type['supports'] = false;
372
  }
373
 
374
+ $labels = [
375
  'name' => $post_type['label'],
376
  'singular_name' => $post_type['singular_label'],
377
+ ];
378
 
379
+ $preserved = cptui_get_preserved_keys( 'post_types' );
380
  $preserved_labels = cptui_get_preserved_labels();
381
  foreach ( $post_type['labels'] as $key => $label ) {
382
 
386
  } else {
387
  $labels[ $key ] = $label;
388
  }
389
+ } elseif ( empty( $label ) && in_array( $key, $preserved, true ) ) {
390
  $singular_or_plural = ( in_array( $key, array_keys( $preserved_labels['post_types']['plural'] ) ) ) ? 'plural' : 'singular';
391
+ $label_plurality = ( 'plural' === $singular_or_plural ) ? $post_type['label'] : $post_type['singular_label'];
392
+ $labels[ $key ] = sprintf( $preserved_labels['post_types'][ $singular_or_plural ][ $key ], $label_plurality );
393
  }
394
  }
395
 
396
+ $has_archive = isset( $post_type['has_archive'] ) ? get_disp_boolean( $post_type['has_archive'] ) : false;
397
  if ( $has_archive && ! empty( $post_type['has_archive_string'] ) ) {
398
  $has_archive = $post_type['has_archive_string'];
399
  }
406
  $rewrite = get_disp_boolean( $post_type['rewrite'] );
407
  if ( false !== $rewrite ) {
408
  // Core converts to an empty array anyway, so safe to leave this instead of passing in boolean true.
409
+ $rewrite = [];
410
+ $rewrite['slug'] = ! empty( $post_type['rewrite_slug'] ) ? $post_type['rewrite_slug'] : $post_type['name'];
411
 
412
  $rewrite['with_front'] = true; // Default value.
413
  if ( isset( $post_type['rewrite_withfront'] ) ) {
414
+ $rewrite['with_front'] = 'false' === disp_boolean( $post_type['rewrite_withfront'] ) ? false : true;
415
  }
416
  }
417
 
418
+ $menu_icon = ! empty( $post_type['menu_icon'] ) ? $post_type['menu_icon'] : null;
419
 
420
+ if ( in_array( $post_type['query_var'], [ 'true', 'false', '0', '1' ], true ) ) {
421
  $post_type['query_var'] = get_disp_boolean( $post_type['query_var'] );
422
  }
423
  if ( ! empty( $post_type['query_var_slug'] ) ) {
429
  $menu_position = (int) $post_type['menu_position'];
430
  }
431
 
432
+ $delete_with_user = null;
433
+ if ( ! empty( $post_type['delete_with_user'] ) ) {
434
+ $delete_with_user = get_disp_boolean( $post_type['delete_with_user'] );
435
+ }
436
+
437
  $capability_type = 'post';
438
  if ( ! empty( $post_type['capability_type'] ) ) {
439
  $capability_type = $post_type['capability_type'];
450
  if ( ! empty( $post_type['exclude_from_search'] ) ) {
451
  $exclude_from_search = get_disp_boolean( $post_type['exclude_from_search'] );
452
  } else {
453
+ $exclude_from_search = false === $public;
454
  }
455
 
456
  $queryable = ( ! empty( $post_type['publicly_queryable'] ) && isset( $post_type['publicly_queryable'] ) ) ? get_disp_boolean( $post_type['publicly_queryable'] ) : $public;
474
  $rest_controller_class = $post_type['rest_controller_class'];
475
  }
476
 
477
+ $args = [
478
  'labels' => $labels,
479
  'description' => $post_type['description'],
480
  'public' => get_disp_boolean( $post_type['public'] ),
483
  'show_in_nav_menus' => get_disp_boolean( $post_type['show_in_nav_menus'] ),
484
  'has_archive' => $has_archive,
485
  'show_in_menu' => $show_in_menu,
486
+ 'delete_with_user' => $delete_with_user,
487
  'show_in_rest' => get_disp_boolean( $post_type['show_in_rest'] ),
488
  'rest_base' => $rest_base,
489
  'rest_controller_class' => $rest_controller_class,
497
  'query_var' => $post_type['query_var'],
498
  'supports' => $post_type['supports'],
499
  'taxonomies' => $post_type['taxonomies'],
500
+ ];
501
 
502
  if ( true === $yarpp ) {
503
  $args['yarpp_support'] = $yarpp;
543
 
544
  if ( is_array( $taxes ) ) {
545
  foreach ( $taxes as $tax ) {
546
+ /**
547
+ * Filters whether or not to skip registration of the current iterated taxonomy.
548
+ *
549
+ * Dynamic part of the filter name is the chosen taxonomy slug.
550
+ *
551
+ * @since 1.7.0
552
+ *
553
+ * @param bool $value Whether or not to skip the taxonomy.
554
+ * @param array $tax Current taxonomy being registered.
555
+ */
556
+ if ( (bool) apply_filters( "cptui_disable_{$tax['name']}_tax", false, $tax ) ) {
557
+ continue;
558
+ }
559
+
560
+ /**
561
+ * Filters whether or not to skip registration of the current iterated taxonomy.
562
+ *
563
+ * @since 1.7.0
564
+ *
565
+ * @param bool $value Whether or not to skip the taxonomy.
566
+ * @param array $tax Current taxonomy being registered.
567
+ */
568
+ if ( (bool) apply_filters( 'cptui_disable_tax', false, $tax ) ) {
569
+ continue;
570
+ }
571
+
572
  cptui_register_single_taxonomy( $tax );
573
  }
574
  }
594
  * @param array $taxonomy Taxonomy array to register. Optional.
595
  * @return null Result of register_taxonomy.
596
  */
597
+ function cptui_register_single_taxonomy( $taxonomy = [] ) {
598
 
599
+ $labels = [
600
+ 'name' => $taxonomy['label'],
601
+ 'singular_name' => $taxonomy['singular_label'],
602
+ ];
603
 
604
  $description = '';
605
  if ( ! empty( $taxonomy['description'] ) ) {
606
  $description = $taxonomy['description'];
607
  }
608
 
609
+ $preserved = cptui_get_preserved_keys( 'taxonomies' );
610
  $preserved_labels = cptui_get_preserved_labels();
611
  foreach ( $taxonomy['labels'] as $key => $label ) {
612
 
613
  if ( ! empty( $label ) ) {
614
  $labels[ $key ] = $label;
615
+ } elseif ( empty( $label ) && in_array( $key, $preserved, true ) ) {
616
  $singular_or_plural = ( in_array( $key, array_keys( $preserved_labels['taxonomies']['plural'] ) ) ) ? 'plural' : 'singular';
617
+ $label_plurality = ( 'plural' === $singular_or_plural ) ? $taxonomy['label'] : $taxonomy['singular_label'];
618
+ $labels[ $key ] = sprintf( $preserved_labels['taxonomies'][ $singular_or_plural ][ $key ], $label_plurality );
619
  }
620
  }
621
 
622
  $rewrite = get_disp_boolean( $taxonomy['rewrite'] );
623
  if ( false !== get_disp_boolean( $taxonomy['rewrite'] ) ) {
624
+ $rewrite = [];
625
+ $rewrite['slug'] = ! empty( $taxonomy['rewrite_slug'] ) ? $taxonomy['rewrite_slug'] : $taxonomy['name'];
626
  $rewrite['with_front'] = true;
627
  if ( isset( $taxonomy['rewrite_withfront'] ) ) {
628
  $rewrite['with_front'] = ( 'false' === disp_boolean( $taxonomy['rewrite_withfront'] ) ) ? false : true;
633
  }
634
  }
635
 
636
+ if ( in_array( $taxonomy['query_var'], [ 'true', 'false', '0', '1' ], true ) ) {
637
  $taxonomy['query_var'] = get_disp_boolean( $taxonomy['query_var'] );
638
  }
639
  if ( true === $taxonomy['query_var'] && ! empty( $taxonomy['query_var_slug'] ) ) {
678
  $meta_box_cb = ( false !== get_disp_boolean( $taxonomy['meta_box_cb'] ) ) ? $taxonomy['meta_box_cb'] : false;
679
  }
680
 
681
+ $args = [
682
  'labels' => $labels,
683
  'label' => $taxonomy['label'],
684
  'description' => $description,
696
  'rest_controller_class' => $rest_controller_class,
697
  'show_in_quick_edit' => $show_in_quick_edit,
698
  'meta_box_cb' => $meta_box_cb,
699
+ ];
700
 
701
+ $object_type = ! empty( $taxonomy['object_types'] ) ? $taxonomy['object_types'] : '';
702
 
703
  /**
704
  * Filters the arguments used for a taxonomy right before registering.
723
  * @since 1.0.0
724
  *
725
  * @param string $page Whether it's the CPT or Taxonomy page. Optional. Default "post_types".
726
+ * @return string
727
  */
728
  function cptui_settings_tab_menu( $page = 'post_types' ) {
729
 
735
  * @param array $value Array of tabs to render.
736
  * @param string $page Current page being displayed.
737
  */
738
+ $tabs = (array) apply_filters( 'cptui_get_tabs', [], $page );
739
 
740
+ if ( empty( $tabs['page_title'] ) ) {
741
+ return '';
 
 
 
742
  }
743
 
744
+ $tmpl = '<h1>%s</h1><nav class="nav-tab-wrapper wp-clearfix" aria-label="Secondary menu">%s</nav>';
745
+
746
+ $tab_output = '';
747
  foreach ( $tabs['tabs'] as $tab ) {
748
+ $tab_output .= sprintf(
749
  '<a class="%s" href="%s" aria-selected="%s">%s</a>',
750
  implode( ' ', $tab['classes'] ),
751
  $tab['url'],
754
  );
755
  }
756
 
757
+ printf(
758
+ $tmpl,
759
+ $tabs['page_title'],
760
+ $tab_output
761
+ );
762
  }
763
 
764
  /**
782
 
783
  if ( false === get_option( 'cptui_post_types' ) && ( $post_types = get_option( 'cpt_custom_post_types' ) ) ) {
784
 
785
+ $new_post_types = [];
786
  foreach ( $post_types as $type ) {
787
+ $new_post_types[ $type['name'] ] = $type; // This one assigns the # indexes. Named arrays are our friend.
788
+ $new_post_types[ $type['name'] ]['supports'] = ! empty( $type[0] ) ? $type[0] : []; // Especially for multidimensional arrays.
789
+ $new_post_types[ $type['name'] ]['taxonomies'] = ! empty( $type[1] ) ? $type[1] : [];
790
+ $new_post_types[ $type['name'] ]['labels'] = ! empty( $type[2] ) ? $type[2] : [];
791
  unset(
792
  $new_post_types[ $type['name'] ][0],
793
  $new_post_types[ $type['name'] ][1],
800
 
801
  if ( false === get_option( 'cptui_taxonomies' ) && ( $taxonomies = get_option( 'cpt_custom_tax_types' ) ) ) {
802
 
803
+ $new_taxonomies = [];
804
  foreach ( $taxonomies as $tax ) {
805
  $new_taxonomies[ $tax['name'] ] = $tax; // Yep, still our friend.
806
+ $new_taxonomies[ $tax['name'] ]['labels'] = $tax[0]; // Taxonomies are the only thing with.
807
  $new_taxonomies[ $tax['name'] ]['object_types'] = $tax[1]; // "tax" in the name that I like.
808
  unset(
809
  $new_taxonomies[ $tax['name'] ][0],
835
  */
836
  function cptui_admin_notices( $action = '', $object_type = '', $success = true, $custom = '' ) {
837
 
838
+ $class = [];
839
+ $class[] = $success ? 'updated' : 'error';
840
+ $class[] = 'notice is-dismissible';
841
  $object_type = esc_attr( $object_type );
842
 
843
  $messagewrapstart = '<div id="message" class="' . implode( ' ', $class ) . '"><p>';
845
 
846
  $messagewrapend = '</p></div>';
847
 
848
+ if ( 'add' === $action ) {
849
  if ( $success ) {
850
  $message .= sprintf( __( '%s has been successfully added', 'custom-post-type-ui' ), $object_type );
851
  } else {
852
  $message .= sprintf( __( '%s has failed to be added', 'custom-post-type-ui' ), $object_type );
853
  }
854
+ } elseif ( 'update' === $action ) {
855
  if ( $success ) {
856
  $message .= sprintf( __( '%s has been successfully updated', 'custom-post-type-ui' ), $object_type );
857
  } else {
858
  $message .= sprintf( __( '%s has failed to be updated', 'custom-post-type-ui' ), $object_type );
859
  }
860
+ } elseif ( 'delete' === $action ) {
861
  if ( $success ) {
862
  $message .= sprintf( __( '%s has been successfully deleted', 'custom-post-type-ui' ), $object_type );
863
  } else {
864
  $message .= sprintf( __( '%s has failed to be deleted', 'custom-post-type-ui' ), $object_type );
865
  }
866
+ } elseif ( 'import' === $action ) {
867
  if ( $success ) {
868
  $message .= sprintf( __( '%s has been successfully imported', 'custom-post-type-ui' ), $object_type );
869
  } else {
870
  $message .= sprintf( __( '%s has failed to be imported', 'custom-post-type-ui' ), $object_type );
871
  }
872
+ } elseif ( 'error' === $action ) {
873
  if ( ! empty( $custom ) ) {
874
  $message = $custom;
875
  }
904
  */
905
  function cptui_get_preserved_keys( $type = '' ) {
906
 
907
+ $preserved_labels = [
908
+ 'post_types' => [
909
  'add_new_item',
910
  'edit_item',
911
  'new_item',
912
  'view_item',
913
+ 'view_items',
914
  'all_items',
915
  'search_items',
916
  'not_found',
917
  'not_found_in_trash',
918
+ ],
919
+ 'taxonomies' => [
920
  'search_items',
921
  'popular_items',
922
  'all_items',
929
  'separate_items_with_commas',
930
  'add_or_remove_items',
931
  'choose_from_most_used',
932
+ ],
933
+ ];
934
+ return ! empty( $type ) ? $preserved_labels[ $type ] : [];
935
  }
936
 
937
  /**
949
  */
950
  function cptui_get_preserved_label( $type = '', $key = '', $plural = '', $singular = '' ) {
951
 
952
+ $preserved_labels = [
953
+ 'post_types' => [
954
  'add_new_item' => sprintf( __( 'Add new %s', 'custom-post-type-ui' ), $singular ),
955
  'edit_item' => sprintf( __( 'Edit %s', 'custom-post-type-ui' ), $singular ),
956
  'new_item' => sprintf( __( 'New %s', 'custom-post-type-ui' ), $singular ),
957
  'view_item' => sprintf( __( 'View %s', 'custom-post-type-ui' ), $singular ),
958
+ 'view_items' => sprintf( __( 'View %s', 'custom-post-type-ui' ), $plural ),
959
  'all_items' => sprintf( __( 'All %s', 'custom-post-type-ui' ), $plural ),
960
  'search_items' => sprintf( __( 'Search %s', 'custom-post-type-ui' ), $plural ),
961
  'not_found' => sprintf( __( 'No %s found.', 'custom-post-type-ui' ), $plural ),
962
  'not_found_in_trash' => sprintf( __( 'No %s found in trash.', 'custom-post-type-ui' ), $plural ),
963
+ ],
964
+ 'taxonomies' => [
965
  'search_items' => sprintf( __( 'Search %s', 'custom-post-type-ui' ), $plural ),
966
  'popular_items' => sprintf( __( 'Popular %s', 'custom-post-type-ui' ), $plural ),
967
  'all_items' => sprintf( __( 'All %s', 'custom-post-type-ui' ), $plural ),
974
  'separate_items_with_commas' => sprintf( __( 'Separate %s with commas', 'custom-post-type-ui' ), $plural ),
975
  'add_or_remove_items' => sprintf( __( 'Add or remove %s', 'custom-post-type-ui' ), $plural ),
976
  'choose_from_most_used' => sprintf( __( 'Choose from the most used %s', 'custom-post-type-ui' ), $plural ),
977
+ ],
978
+ ];
979
 
980
  return $preserved_labels[ $type ][ $key ];
981
  }
990
  * @return array
991
  */
992
  function cptui_get_preserved_labels() {
993
+ return [
994
+ 'post_types' => [
995
+ 'singular' => [
996
  'add_new_item' => __( 'Add new %s', 'custom-post-type-ui' ),
997
  'edit_item' => __( 'Edit %s', 'custom-post-type-ui' ),
998
  'new_item' => __( 'New %s', 'custom-post-type-ui' ),
999
  'view_item' => __( 'View %s', 'custom-post-type-ui' ),
1000
+ ],
1001
+ 'plural' => [
1002
+ 'view_items' => __( 'View %s', 'custom-post-type-ui' ),
1003
  'all_items' => __( 'All %s', 'custom-post-type-ui' ),
1004
  'search_items' => __( 'Search %s', 'custom-post-type-ui' ),
1005
  'not_found' => __( 'No %s found.', 'custom-post-type-ui' ),
1006
  'not_found_in_trash' => __( 'No %s found in trash.', 'custom-post-type-ui' ),
1007
+ ],
1008
+ ],
1009
+ 'taxonomies' => [
1010
+ 'singular' => [
1011
  'parent_item' => __( 'Parent %s', 'custom-post-type-ui' ),
1012
  'parent_item_colon' => __( 'Parent %s:', 'custom-post-type-ui' ),
1013
  'edit_item' => __( 'Edit %s', 'custom-post-type-ui' ),
1014
  'update_item' => __( 'Update %s', 'custom-post-type-ui' ),
1015
  'add_new_item' => __( 'Add new %s', 'custom-post-type-ui' ),
1016
  'new_item_name' => __( 'New %s name', 'custom-post-type-ui' ),
1017
+ ],
1018
+ 'plural' => [
1019
  'search_items' => __( 'Search %s', 'custom-post-type-ui' ),
1020
  'popular_items' => __( 'Popular %s', 'custom-post-type-ui' ),
1021
  'all_items' => __( 'All %s', 'custom-post-type-ui' ),
1022
  'separate_items_with_commas' => __( 'Separate %s with commas', 'custom-post-type-ui' ),
1023
  'add_or_remove_items' => __( 'Add or remove %s', 'custom-post-type-ui' ),
1024
  'choose_from_most_used' => __( 'Choose from the most used %s', 'custom-post-type-ui' ),
1025
+ ],
1026
+ ],
1027
+ ];
1028
  }
inc/about.php CHANGED
@@ -9,6 +9,8 @@
9
  * @license GPL-2.0+
10
  */
11
 
 
 
12
  // Exit if accessed directly.
13
  if ( ! defined( 'ABSPATH' ) ) {
14
  exit;
@@ -51,7 +53,8 @@ function cptui_settings() {
51
  *
52
  * @since 1.0.0
53
  */
54
- do_action( 'cptui_main_page_start' ); ?>
 
55
  <h1><?php esc_html_e( 'Custom Post Type UI', 'custom-post-type-ui' ); ?> <?php echo esc_html( CPTUI_VERSION ); ?></h1>
56
 
57
  <?php
@@ -75,22 +78,23 @@ function cptui_settings() {
75
  *
76
  * @since 1.4.0
77
  */
78
- do_action( 'cptui_main_page_before_changelog' ); ?>
 
79
 
80
  <h2><?php printf( esc_html__( "What's new in version %s", 'custom-post-type-ui' ), CPTUI_VERSION ); ?></h2>
81
  <div class="changelog about-integrations">
82
  <div class="cptui-feature feature-section col three-col">
83
  <div class="col">
84
- <h2><?php esc_html_e( 'Taxonomy support for meta_box_cb parameter', 'custom-post-type-ui' ); ?></h2>
85
- <p><?php esc_html_e( 'We have added a field to provide a function callback to use for the metabox for your taxonomies. This allows you to customize and provide your own metabox output instead of using the default.', 'custom-post-type-ui' ); ?></p>
86
  </div>
87
  <div class="col">
88
- <h2><?php esc_html_e( 'WP-CLI Support', 'custom-post-type-ui' ); ?></h2>
89
- <p><?php esc_html_e( 'We have added some initial WP-CLI support around importing and exporting your Custom Post Type UI settings. This will help with setting up your websites and provide some possible automation tools.', 'custom-post-type-ui' ); ?></p>
90
  </div>
91
  <div class="col last-feature">
92
- <h2><?php esc_html_e( 'Adjusted default "Show in REST" parameter.', 'custom-post-type-ui' ); ?></h2>
93
- <p><?php esc_html_e( 'Gutenberg is coming with WordPress 5.0. For post types to have "Gutenberg" support, the "Show in REST" parameter needs to be set to true. We are changing this to help ease users into better integration.', 'custom-post-type-ui' ) ?></p>
94
  </div>
95
  </div>
96
  </div>
@@ -103,7 +107,8 @@ function cptui_settings() {
103
  *
104
  * @since 1.3.0
105
  */
106
- do_action( 'cptui_main_page_extra_notes' ); ?>
 
107
  </div>
108
  </div>
109
  <?php
9
  * @license GPL-2.0+
10
  */
11
 
12
+ // phpcs:disable WebDevStudios.All.RequireAuthor
13
+
14
  // Exit if accessed directly.
15
  if ( ! defined( 'ABSPATH' ) ) {
16
  exit;
53
  *
54
  * @since 1.0.0
55
  */
56
+ do_action( 'cptui_main_page_start' );
57
+ ?>
58
  <h1><?php esc_html_e( 'Custom Post Type UI', 'custom-post-type-ui' ); ?> <?php echo esc_html( CPTUI_VERSION ); ?></h1>
59
 
60
  <?php
78
  *
79
  * @since 1.4.0
80
  */
81
+ do_action( 'cptui_main_page_before_changelog' );
82
+ ?>
83
 
84
  <h2><?php printf( esc_html__( "What's new in version %s", 'custom-post-type-ui' ), CPTUI_VERSION ); ?></h2>
85
  <div class="changelog about-integrations">
86
  <div class="cptui-feature feature-section col three-col">
87
  <div class="col">
88
+ <h2><?php esc_html_e( 'Ability to temporarily disable content types without deleting them.', 'custom-post-type-ui' ); ?></h2>
89
+ <p><?php esc_html_e( 'Have you ever wanted to temporarily disable things without removing their settings, as you continue developing the site? Custom Post Type UI now has the ability to skip content types with a WordPress filter. UI options to toggle will be in a later version.', 'custom-post-type-ui' ); ?></p>
90
  </div>
91
  <div class="col">
92
+ <h2><?php esc_html_e( 'New post type labels introduced in WordPress 5.0', 'custom-post-type-ui' ); ?></h2>
93
+ <p><?php esc_html_e( 'We have increased our minimum supported WordPress version and with that, we now support the newest available label options. You now have even finer control over your admin UI wording.', 'custom-post-type-ui' ); ?></p>
94
  </div>
95
  <div class="col last-feature">
96
+ <h2></h2>
97
+ <p></p>
98
  </div>
99
  </div>
100
  </div>
107
  *
108
  * @since 1.3.0
109
  */
110
+ do_action( 'cptui_main_page_extra_notes' );
111
+ ?>
112
  </div>
113
  </div>
114
  <?php
inc/listings.php CHANGED
@@ -9,6 +9,8 @@
9
  * @license GPL-2.0+
10
  */
11
 
 
 
12
  // Exit if accessed directly.
13
  if ( ! defined( 'ABSPATH' ) ) {
14
  exit;
@@ -53,13 +55,16 @@ function cptui_listings() {
53
  do_action( 'cptui_inside_listings_wrap' );
54
  ?>
55
 
56
- <h1><?php esc_html_e( 'Post Types and Taxonomies registered by Custom Post Type UI.', 'custom-post-type-ui' ); ?></h1>
 
 
57
  <?php
58
  $post_types = cptui_get_post_type_data();
59
  echo '<h2 id="post-types">' . esc_html__( 'Post Types', 'custom-post-type-ui' ) . '</h2>';
60
  if ( ! empty( $post_types ) ) {
61
  ?>
62
- <p><?php
 
63
  printf(
64
  /* translators: %s: Total count of registered CPTUI post types */
65
  esc_html__( 'Custom Post Type UI registered post types count total: %d', 'custom-post-type-ui' ),
@@ -70,14 +75,14 @@ function cptui_listings() {
70
 
71
  <?php
72
 
73
- $post_type_table_heads = array(
74
- __( 'Post Type', 'custom-post-type-ui' ),
75
- __( 'Settings', 'custom-post-type-ui' ),
76
- __( 'Supports', 'custom-post-type-ui' ),
77
- __( 'Taxonomies', 'custom-post-type-ui' ),
78
- __( 'Labels', 'custom-post-type-ui' ),
79
- __( 'Template Hierarchy', 'custom-post-type-ui' ),
80
- );
81
 
82
  /**
83
  * Fires before the listing of registered post type data.
@@ -92,7 +97,8 @@ function cptui_listings() {
92
  <?php
93
  foreach ( $post_type_table_heads as $head ) {
94
  echo '<th>' . esc_html( $head ) . '</th>';
95
- } ?>
 
96
  </tr>
97
  </thead>
98
  <tbody>
@@ -102,10 +108,10 @@ function cptui_listings() {
102
 
103
  $rowclass = ( 0 === $counter % 2 ) ? '' : 'alternate';
104
 
105
- $strings = array();
106
- $supports = array();
107
- $taxonomies = array();
108
- $archive = '';
109
  foreach ( $post_type_settings as $settings_key => $settings_value ) {
110
  if ( 'labels' === $settings_key ) {
111
  continue;
@@ -133,7 +139,8 @@ function cptui_listings() {
133
  <tr class="<?php echo esc_attr( $rowclass ); ?>">
134
  <?php
135
  $edit_path = 'admin.php?page=cptui_manage_post_types&action=edit&cptui_post_type=' . $post_type;
136
- $post_type_link_url = ( is_network_admin() ) ? network_admin_url( $edit_path ) : admin_url( $edit_path ); ?>
 
137
  <td>
138
  <?php
139
  printf(
@@ -142,7 +149,8 @@ function cptui_listings() {
142
  esc_attr( $post_type_link_url ),
143
  sprintf(
144
  /* translators: %s: Post type slug */
145
- esc_html__( 'Edit %s', 'custom-post-type-ui' ),
 
146
  esc_html( $post_type )
147
  ),
148
  esc_attr( admin_url( 'admin.php?page=cptui_tools&action=get_code#' . $post_type ) ),
@@ -158,19 +166,21 @@ function cptui_listings() {
158
  <?php
159
  foreach ( $strings as $key => $value ) {
160
  printf( '<strong>%s:</strong> ', esc_html( $key ) );
161
- if ( in_array( $value, array( '1', '0' ), true ) ) {
162
  echo esc_html( disp_boolean( $value ) );
163
  } else {
164
- echo ( ! empty( $value ) ) ? esc_html( $value ) : '""';
165
  }
166
  echo '<br/>';
167
- } ?>
 
168
  </td>
169
  <td>
170
  <?php
171
  foreach ( $supports['supports'] as $support ) {
172
  echo esc_html( $support ) . '<br/>';
173
- } ?>
 
174
  </td>
175
  <td>
176
  <?php
@@ -195,7 +205,7 @@ function cptui_listings() {
195
  continue;
196
  }
197
  printf(
198
- '%s: %s<br/>',
199
  esc_html( $key ),
200
  esc_html( $value )
201
  );
@@ -227,11 +237,13 @@ function cptui_listings() {
227
  <?php esc_html_e( '*Replace "post_slug" with the slug of the actual post slug.', 'custom-post-type-ui' ); ?>
228
  </p>
229
 
230
- <p><?php
 
231
  printf(
232
  '<a href="https://developer.wordpress.org/themes/basics/template-hierarchy/">%s</a>',
233
  esc_html__( 'Template hierarchy Theme Handbook', 'custom-post-type-ui' )
234
- ); ?>
 
235
  </p>
236
  </td>
237
  </tr>
@@ -246,7 +258,8 @@ function cptui_listings() {
246
  <?php
247
  foreach ( $post_type_table_heads as $head ) {
248
  echo '<th>' . esc_html( $head ) . '</th>';
249
- } ?>
 
250
  </tr>
251
  </tfoot>
252
  </table>
@@ -283,13 +296,13 @@ function cptui_listings() {
283
 
284
  <?php
285
 
286
- $taxonomy_table_heads = array(
287
- __( 'Taxonomy', 'custom-post-type-ui' ),
288
- __( 'Settings', 'custom-post-type-ui' ),
289
- __( 'Post Types', 'custom-post-type-ui' ),
290
- __( 'Labels', 'custom-post-type-ui' ),
291
- __( 'Template Hierarchy', 'custom-post-type-ui' ),
292
- );
293
 
294
  /**
295
  * Fires before the listing of registered taxonomy data.
@@ -304,7 +317,8 @@ function cptui_listings() {
304
  <?php
305
  foreach ( $taxonomy_table_heads as $head ) {
306
  echo '<th>' . esc_html( $head ) . '</th>';
307
- } ?>
 
308
  </tr>
309
  </thead>
310
  <tbody>
@@ -314,8 +328,8 @@ function cptui_listings() {
314
 
315
  $rowclass = ( 0 === $counter % 2 ) ? '' : 'alternate';
316
 
317
- $strings = array();
318
- $object_types = array();
319
  foreach ( $taxonomy_settings as $settings_key => $settings_value ) {
320
  if ( 'labels' === $settings_key ) {
321
  continue;
@@ -329,7 +343,7 @@ function cptui_listings() {
329
 
330
  // In case they are not associated from the post type settings.
331
  if ( empty( $object_types['object_types'] ) ) {
332
- $types = get_taxonomy( $taxonomy );
333
  $object_types['object_types'] = $types->object_type;
334
  }
335
  }
@@ -338,33 +352,38 @@ function cptui_listings() {
338
  ?>
339
  <tr class="<?php echo esc_attr( $rowclass ); ?>">
340
  <?php
341
- $edit_path = 'admin.php?page=cptui_manage_taxonomies&action=edit&cptui_taxonomy=' . $taxonomy;
342
- $taxonomy_link_url = ( is_network_admin() ) ? network_admin_url( $edit_path ) : admin_url( $edit_path ); ?>
 
343
  <td>
344
- <?php printf(
 
345
  '<a href="%s">%s</a><br/>
346
  <a href="%s">%s</a>',
347
  esc_attr( $taxonomy_link_url ),
348
  sprintf(
349
  /* translators: %s: Taxonomy slug */
350
- esc_html__( 'Edit %s', 'custom-post-type-ui' ),
 
351
  esc_html( $taxonomy )
352
  ),
353
  esc_attr( admin_url( 'admin.php?page=cptui_tools&action=get_code#' . $taxonomy ) ),
354
  esc_html__( 'Get code', 'custom-post-type-ui' )
355
- ); ?>
 
356
  </td>
357
  <td>
358
  <?php
359
  foreach ( $strings as $key => $value ) {
360
  printf( '<strong>%s:</strong> ', esc_html( $key ) );
361
- if ( in_array( $value, array( '1', '0' ), true ) ) {
362
  echo esc_html( disp_boolean( $value ) );
363
  } else {
364
- echo ( ! empty( $value ) ) ? esc_html( $value ) : '""';
365
  }
366
  echo '<br/>';
367
- } ?>
 
368
  </td>
369
  <td>
370
  <?php
@@ -372,7 +391,8 @@ function cptui_listings() {
372
  foreach ( $object_types['object_types'] as $type ) {
373
  echo esc_html( $type ) . '<br/>';
374
  }
375
- } ?>
 
376
  </td>
377
  <td>
378
  <?php
@@ -380,7 +400,7 @@ function cptui_listings() {
380
  if ( ! empty( $maybe_empty ) ) {
381
  foreach ( $taxonomy_settings['labels'] as $key => $value ) {
382
  printf(
383
- '%s: %s<br/>',
384
  esc_html( $key ),
385
  esc_html( $value )
386
  );
@@ -405,11 +425,14 @@ function cptui_listings() {
405
  <p>
406
  <?php esc_html_e( '*Replace "term_slug" with the slug of the actual taxonomy term.', 'custom-post-type-ui' ); ?>
407
  </p>
408
- <p><?php
 
409
  printf(
410
  '<a href="https://developer.wordpress.org/themes/basics/template-hierarchy/">%s</a>',
411
  esc_html__( 'Template hierarchy Theme Handbook', 'custom-post-type-ui' )
412
- ); ?></p>
 
 
413
  </td>
414
  </tr>
415
 
@@ -423,7 +446,8 @@ function cptui_listings() {
423
  <?php
424
  foreach ( $taxonomy_table_heads as $head ) {
425
  echo '<th>' . esc_html( $head ) . '</th>';
426
- } ?>
 
427
  </tr>
428
  </tfoot>
429
  </table>
9
  * @license GPL-2.0+
10
  */
11
 
12
+ // phpcs:disable WebDevStudios.All.RequireAuthor
13
+
14
  // Exit if accessed directly.
15
  if ( ! defined( 'ABSPATH' ) ) {
16
  exit;
55
  do_action( 'cptui_inside_listings_wrap' );
56
  ?>
57
 
58
+ <h1 class="wp-heading-inline"><?php esc_html_e( 'Content types registered with Custom Post Type UI.', 'custom-post-type-ui' ); ?></h1>
59
+ <a href="<?php echo esc_url( cptui_get_add_new_link( 'post_types' ) ); ?>" class="page-title-action"><?php esc_html_e( 'Add New Post Type', 'custom-post-type-ui' ); ?></a>
60
+ <a href="<?php echo esc_url( cptui_get_add_new_link( 'taxonomies' ) ); ?>" class="page-title-action"><?php esc_html_e( 'Add New Taxonomy', 'custom-post-type-ui' ); ?></a>
61
  <?php
62
  $post_types = cptui_get_post_type_data();
63
  echo '<h2 id="post-types">' . esc_html__( 'Post Types', 'custom-post-type-ui' ) . '</h2>';
64
  if ( ! empty( $post_types ) ) {
65
  ?>
66
+ <p>
67
+ <?php
68
  printf(
69
  /* translators: %s: Total count of registered CPTUI post types */
70
  esc_html__( 'Custom Post Type UI registered post types count total: %d', 'custom-post-type-ui' ),
75
 
76
  <?php
77
 
78
+ $post_type_table_heads = [
79
+ esc_html__( 'Post Type', 'custom-post-type-ui' ),
80
+ esc_html__( 'Settings', 'custom-post-type-ui' ),
81
+ esc_html__( 'Supports', 'custom-post-type-ui' ),
82
+ esc_html__( 'Taxonomies', 'custom-post-type-ui' ),
83
+ esc_html__( 'Labels', 'custom-post-type-ui' ),
84
+ esc_html__( 'Template Hierarchy', 'custom-post-type-ui' ),
85
+ ];
86
 
87
  /**
88
  * Fires before the listing of registered post type data.
97
  <?php
98
  foreach ( $post_type_table_heads as $head ) {
99
  echo '<th>' . esc_html( $head ) . '</th>';
100
+ }
101
+ ?>
102
  </tr>
103
  </thead>
104
  <tbody>
108
 
109
  $rowclass = ( 0 === $counter % 2 ) ? '' : 'alternate';
110
 
111
+ $strings = [];
112
+ $supports = [];
113
+ $taxonomies = [];
114
+ $archive = '';
115
  foreach ( $post_type_settings as $settings_key => $settings_value ) {
116
  if ( 'labels' === $settings_key ) {
117
  continue;
139
  <tr class="<?php echo esc_attr( $rowclass ); ?>">
140
  <?php
141
  $edit_path = 'admin.php?page=cptui_manage_post_types&action=edit&cptui_post_type=' . $post_type;
142
+ $post_type_link_url = is_network_admin() ? network_admin_url( $edit_path ) : admin_url( $edit_path );
143
+ ?>
144
  <td>
145
  <?php
146
  printf(
149
  esc_attr( $post_type_link_url ),
150
  sprintf(
151
  /* translators: %s: Post type slug */
152
+ esc_html__( 'Edit %1$s (%2$s)', 'custom-post-type-ui' ),
153
+ esc_html( $post_type_settings['label'] ),
154
  esc_html( $post_type )
155
  ),
156
  esc_attr( admin_url( 'admin.php?page=cptui_tools&action=get_code#' . $post_type ) ),
166
  <?php
167
  foreach ( $strings as $key => $value ) {
168
  printf( '<strong>%s:</strong> ', esc_html( $key ) );
169
+ if ( in_array( $value, [ '1', '0' ], true ) ) {
170
  echo esc_html( disp_boolean( $value ) );
171
  } else {
172
+ echo ! empty( $value ) ? esc_html( $value ) : '""';
173
  }
174
  echo '<br/>';
175
+ }
176
+ ?>
177
  </td>
178
  <td>
179
  <?php
180
  foreach ( $supports['supports'] as $support ) {
181
  echo esc_html( $support ) . '<br/>';
182
+ }
183
+ ?>
184
  </td>
185
  <td>
186
  <?php
205
  continue;
206
  }
207
  printf(
208
+ '<strong>%s</strong>: %s<br/>',
209
  esc_html( $key ),
210
  esc_html( $value )
211
  );
237
  <?php esc_html_e( '*Replace "post_slug" with the slug of the actual post slug.', 'custom-post-type-ui' ); ?>
238
  </p>
239
 
240
+ <p>
241
+ <?php
242
  printf(
243
  '<a href="https://developer.wordpress.org/themes/basics/template-hierarchy/">%s</a>',
244
  esc_html__( 'Template hierarchy Theme Handbook', 'custom-post-type-ui' )
245
+ );
246
+ ?>
247
  </p>
248
  </td>
249
  </tr>
258
  <?php
259
  foreach ( $post_type_table_heads as $head ) {
260
  echo '<th>' . esc_html( $head ) . '</th>';
261
+ }
262
+ ?>
263
  </tr>
264
  </tfoot>
265
  </table>
296
 
297
  <?php
298
 
299
+ $taxonomy_table_heads = [
300
+ esc_html__( 'Taxonomy', 'custom-post-type-ui' ),
301
+ esc_html__( 'Settings', 'custom-post-type-ui' ),
302
+ esc_html__( 'Post Types', 'custom-post-type-ui' ),
303
+ esc_html__( 'Labels', 'custom-post-type-ui' ),
304
+ esc_html__( 'Template Hierarchy', 'custom-post-type-ui' ),
305
+ ];
306
 
307
  /**
308
  * Fires before the listing of registered taxonomy data.
317
  <?php
318
  foreach ( $taxonomy_table_heads as $head ) {
319
  echo '<th>' . esc_html( $head ) . '</th>';
320
+ }
321
+ ?>
322
  </tr>
323
  </thead>
324
  <tbody>
328
 
329
  $rowclass = ( 0 === $counter % 2 ) ? '' : 'alternate';
330
 
331
+ $strings = [];
332
+ $object_types = [];
333
  foreach ( $taxonomy_settings as $settings_key => $settings_value ) {
334
  if ( 'labels' === $settings_key ) {
335
  continue;
343
 
344
  // In case they are not associated from the post type settings.
345
  if ( empty( $object_types['object_types'] ) ) {
346
+ $types = get_taxonomy( $taxonomy );
347
  $object_types['object_types'] = $types->object_type;
348
  }
349
  }
352
  ?>
353
  <tr class="<?php echo esc_attr( $rowclass ); ?>">
354
  <?php
355
+ $edit_path = 'admin.php?page=cptui_manage_taxonomies&action=edit&cptui_taxonomy=' . $taxonomy;
356
+ $taxonomy_link_url = is_network_admin() ? network_admin_url( $edit_path ) : admin_url( $edit_path );
357
+ ?>
358
  <td>
359
+ <?php
360
+ printf(
361
  '<a href="%s">%s</a><br/>
362
  <a href="%s">%s</a>',
363
  esc_attr( $taxonomy_link_url ),
364
  sprintf(
365
  /* translators: %s: Taxonomy slug */
366
+ esc_html__( 'Edit %1$s (%2$s)', 'custom-post-type-ui' ),
367
+ esc_html( $taxonomy_settings['label'] ),
368
  esc_html( $taxonomy )
369
  ),
370
  esc_attr( admin_url( 'admin.php?page=cptui_tools&action=get_code#' . $taxonomy ) ),
371
  esc_html__( 'Get code', 'custom-post-type-ui' )
372
+ );
373
+ ?>
374
  </td>
375
  <td>
376
  <?php
377
  foreach ( $strings as $key => $value ) {
378
  printf( '<strong>%s:</strong> ', esc_html( $key ) );
379
+ if ( in_array( $value, [ '1', '0' ], true ) ) {
380
  echo esc_html( disp_boolean( $value ) );
381
  } else {
382
+ echo ! empty( $value ) ? esc_html( $value ) : '""';
383
  }
384
  echo '<br/>';
385
+ }
386
+ ?>
387
  </td>
388
  <td>
389
  <?php
391
  foreach ( $object_types['object_types'] as $type ) {
392
  echo esc_html( $type ) . '<br/>';
393
  }
394
+ }
395
+ ?>
396
  </td>
397
  <td>
398
  <?php
400
  if ( ! empty( $maybe_empty ) ) {
401
  foreach ( $taxonomy_settings['labels'] as $key => $value ) {
402
  printf(
403
+ '<strong>%s</strong>: %s<br/>',
404
  esc_html( $key ),
405
  esc_html( $value )
406
  );
425
  <p>
426
  <?php esc_html_e( '*Replace "term_slug" with the slug of the actual taxonomy term.', 'custom-post-type-ui' ); ?>
427
  </p>
428
+ <p>
429
+ <?php
430
  printf(
431
  '<a href="https://developer.wordpress.org/themes/basics/template-hierarchy/">%s</a>',
432
  esc_html__( 'Template hierarchy Theme Handbook', 'custom-post-type-ui' )
433
+ );
434
+ ?>
435
+ </p>
436
  </td>
437
  </tr>
438
 
446
  <?php
447
  foreach ( $taxonomy_table_heads as $head ) {
448
  echo '<th>' . esc_html( $head ) . '</th>';
449
+ }
450
+ ?>
451
  </tr>
452
  </tfoot>
453
  </table>
inc/post-types.php CHANGED
@@ -9,6 +9,8 @@
9
  * @license GPL-2.0+
10
  */
11
 
 
 
12
  // Exit if accessed directly.
13
  if ( ! defined( 'ABSPATH' ) ) {
14
  exit;
@@ -37,16 +39,16 @@ function cptui_post_type_enqueue_scripts() {
37
  wp_enqueue_script( 'cptui' );
38
  wp_enqueue_style( 'cptui-css' );
39
 
40
- $core = get_post_types( array( '_builtin' => true ) );
41
- $public = get_post_types( array( '_builtin' => false, 'public' => true ) );
42
- $private = get_post_types( array( '_builtin' => false, 'public' => false ) );
43
  $registered_post_types = array_merge( $core, $public, $private );
44
 
45
  wp_localize_script( 'cptui', 'cptui_type_data',
46
- array(
47
- 'confirm' => esc_html__( 'Are you sure you want to delete this? Deleting will NOT remove created content.', 'custom-post-type-ui' ),
48
  'existing_post_types' => $registered_post_types,
49
- )
50
  );
51
  }
52
  add_action( 'admin_enqueue_scripts', 'cptui_post_type_enqueue_scripts' );
@@ -62,25 +64,25 @@ add_action( 'admin_enqueue_scripts', 'cptui_post_type_enqueue_scripts' );
62
  * @param string $current_page Current page being shown. Optional. Default empty string.
63
  * @return array Amended array of tabs to show.
64
  */
65
- function cptui_post_type_tabs( $tabs = array(), $current_page = '' ) {
66
 
67
  if ( 'post_types' === $current_page ) {
68
  $post_types = cptui_get_post_type_data();
69
- $classes = array( 'nav-tab' );
70
 
71
  $tabs['page_title'] = get_admin_page_title();
72
- $tabs['tabs'] = array();
73
  // Start out with our basic "Add new" tab.
74
- $tabs['tabs']['add'] = array(
75
  'text' => __( 'Add New Post Type', 'custom-post-type-ui' ),
76
  'classes' => $classes,
77
  'url' => cptui_admin_url( 'admin.php?page=cptui_manage_' . $current_page ),
78
  'aria-selected' => 'false',
79
- );
80
 
81
  $action = cptui_get_current_action();
82
  if ( empty( $action ) ) {
83
- $tabs['tabs']['add']['classes'][] = 'nav-tab-active';
84
  $tabs['tabs']['add']['aria-selected'] = 'true';
85
  }
86
 
@@ -89,26 +91,26 @@ function cptui_post_type_tabs( $tabs = array(), $current_page = '' ) {
89
  if ( ! empty( $action ) ) {
90
  $classes[] = 'nav-tab-active';
91
  }
92
- $tabs['tabs']['edit'] = array(
93
  'text' => __( 'Edit Post Types', 'custom-post-type-ui' ),
94
  'classes' => $classes,
95
- 'url' => esc_url( add_query_arg( array( 'action' => 'edit' ), cptui_admin_url( 'admin.php?page=cptui_manage_' . $current_page ) ) ),
96
- 'aria-selected' => ( ! empty( $action ) ) ? 'true' : 'false',
97
- );
98
 
99
- $tabs['tabs']['view'] = array(
100
  'text' => __( 'View Post Types', 'custom-post-type-ui' ),
101
- 'classes' => array( 'nav-tab' ), // Prevent notices.
102
  'url' => esc_url( cptui_admin_url( 'admin.php?page=cptui_listings#post-types' ) ),
103
  'aria-selected' => 'false',
104
- );
105
 
106
- $tabs['tabs']['export'] = array(
107
  'text' => __( 'Import/Export Post Types', 'custom-post-type-ui' ),
108
- 'classes' => array( 'nav-tab' ), // Prevent notices.
109
  'url' => esc_url( cptui_admin_url( 'admin.php?page=cptui_tools' ) ),
110
  'aria-selected' => 'false',
111
- );
112
  }
113
  }
114
 
@@ -164,10 +166,8 @@ function cptui_manage_post_types() {
164
 
165
  $selected_post_type = cptui_get_current_post_type( $post_type_deleted );
166
 
167
- if ( $selected_post_type ) {
168
- if ( array_key_exists( $selected_post_type, $post_types ) ) {
169
- $current = $post_types[ $selected_post_type ];
170
- }
171
  }
172
  }
173
 
@@ -230,16 +230,16 @@ function cptui_manage_post_types() {
230
 
231
  echo $ui->get_th_end() . $ui->get_td_start();
232
 
233
- echo $ui->get_text_input( array(
234
- 'namearray' => 'cpt_custom_post_type',
235
- 'name' => 'name',
236
- 'textvalue' => ( isset( $current['name'] ) ) ? esc_attr( $current['name'] ) : '',
237
- 'maxlength' => '20',
238
- 'helptext' => esc_html__( 'The post type name/slug. Used for various queries for post type content.', 'custom-post-type-ui' ),
239
- 'required' => true,
240
- 'placeholder' => false,
241
- 'wrap' => false,
242
- ) );
243
  echo '<p class="cptui-slug-details">';
244
  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' );
245
  echo '</p>';
@@ -250,7 +250,7 @@ function cptui_manage_post_types() {
250
  echo '</p>';
251
 
252
  echo '<div class="cptui-spacer">';
253
- echo $ui->get_check_input( array(
254
  'checkvalue' => 'update_post_types',
255
  'checked' => 'false',
256
  'name' => 'update_post_types',
@@ -259,33 +259,45 @@ function cptui_manage_post_types() {
259
  'helptext' => false,
260
  'default' => false,
261
  'wrap' => false,
262
- ) );
263
  echo '</div>';
264
  }
265
 
266
  echo $ui->get_td_end(); echo $ui->get_tr_end();
267
 
268
- echo $ui->get_text_input( array(
269
  'namearray' => 'cpt_custom_post_type',
270
  'name' => 'label',
271
- 'textvalue' => ( isset( $current['label'] ) ) ? esc_attr( $current['label'] ) : '',
272
  'labeltext' => esc_html__( 'Plural Label', 'custom-post-type-ui' ),
273
  'aftertext' => esc_html__( '(e.g. Movies)', 'custom-post-type-ui' ),
274
  'helptext' => esc_html__( 'Used for the post type admin menu item.', 'custom-post-type-ui' ),
275
  'required' => true,
276
- ) );
277
 
278
- echo $ui->get_text_input( array(
279
  'namearray' => 'cpt_custom_post_type',
280
  'name' => 'singular_label',
281
- 'textvalue' => ( isset( $current['singular_label'] ) ) ? esc_attr( $current['singular_label'] ) : '',
282
  'labeltext' => esc_html__( 'Singular Label', 'custom-post-type-ui' ),
283
  'aftertext' => esc_html__( '(e.g. Movie)', 'custom-post-type-ui' ),
284
  'helptext' => esc_html__( 'Used when a singular label is needed.', 'custom-post-type-ui' ),
285
  'required' => true,
286
- ) );
287
- ?>
288
- </table>
 
 
 
 
 
 
 
 
 
 
 
 
289
  <p class="submit">
290
  <?php wp_nonce_field( 'cptui_addedit_post_type_nonce_action', 'cptui_addedit_post_type_nonce_field' );
291
  if ( ! empty( $_GET ) && ! empty( $_GET['action'] ) && 'edit' === $_GET['action'] ) { ?>
@@ -335,7 +347,7 @@ function cptui_manage_post_types() {
335
  </div>
336
  </div>
337
  </div>
338
- <div class="cptui-section postbox">
339
  <button type="button" class="handlediv button-link" aria-expanded="true">
340
  <span class="screen-reader-text"><?php esc_html_e( 'Toggle panel: Additional labels', 'custom-post-type-ui' ); ?></span>
341
  <span class="toggle-indicator" aria-hidden="true"></span>
@@ -351,239 +363,429 @@ function cptui_manage_post_types() {
351
  if ( isset( $current['description'] ) ) {
352
  $current['description'] = stripslashes_deep( $current['description'] );
353
  }
354
- echo $ui->get_textarea_input( array(
355
  'namearray' => 'cpt_custom_post_type',
356
  'name' => 'description',
357
  'rows' => '4',
358
  'cols' => '40',
359
- 'textvalue' => ( isset( $current['description'] ) ) ? esc_textarea( $current['description'] ) : '',
360
  'labeltext' => esc_html__( 'Post Type Description', 'custom-post-type-ui' ),
361
  'helptext' => esc_html__( 'Perhaps describe what your custom post type is used for?', 'custom-post-type-ui' ),
362
- ) );
363
 
364
- echo $ui->get_text_input( array(
365
  'labeltext' => esc_html__( 'Menu Name', 'custom-post-type-ui' ),
366
  'helptext' => esc_html__( 'Custom admin menu name for your custom post type.', 'custom-post-type-ui' ),
367
  'namearray' => 'cpt_labels',
368
  'name' => 'menu_name',
369
- 'textvalue' => ( isset( $current['labels']['menu_name'] ) ) ? esc_attr( $current['labels']['menu_name'] ) : '',
370
  'aftertext' => esc_html__( '(e.g. My Movies)', 'custom-post-type-ui' ),
371
- ) );
372
-
373
- echo $ui->get_text_input( array(
 
 
 
 
 
374
  'labeltext' => esc_html__( 'All Items', 'custom-post-type-ui' ),
375
  'helptext' => esc_html__( 'Used in the post type admin submenu.', 'custom-post-type-ui' ),
376
  'namearray' => 'cpt_labels',
377
  'name' => 'all_items',
378
- 'textvalue' => ( isset( $current['labels']['all_items'] ) ) ? esc_attr( $current['labels']['all_items'] ) : '',
379
  'aftertext' => esc_html__( '(e.g. All Movies)', 'custom-post-type-ui' ),
380
- ) );
381
-
382
- echo $ui->get_text_input( array(
 
 
 
 
 
383
  'labeltext' => esc_html__( 'Add New', 'custom-post-type-ui' ),
384
  'helptext' => esc_html__( 'Used in the post type admin submenu.', 'custom-post-type-ui' ),
385
  'namearray' => 'cpt_labels',
386
  'name' => 'add_new',
387
- 'textvalue' => ( isset( $current['labels']['add_new'] ) ) ? esc_attr( $current['labels']['add_new'] ) : '',
388
  'aftertext' => esc_html__( '(e.g. Add New)', 'custom-post-type-ui' ),
389
- ) );
390
-
391
- echo $ui->get_text_input( array(
 
 
 
 
 
392
  'labeltext' => esc_html__( 'Add New Item', 'custom-post-type-ui' ),
393
  'helptext' => esc_html__( 'Used at the top of the post editor screen for a new post type post.', 'custom-post-type-ui' ),
394
  'namearray' => 'cpt_labels',
395
  'name' => 'add_new_item',
396
- 'textvalue' => ( isset( $current['labels']['add_new_item'] ) ) ? esc_attr( $current['labels']['add_new_item'] ) : '',
397
  'aftertext' => esc_html__( '(e.g. Add New Movie)', 'custom-post-type-ui' ),
398
- ) );
399
-
400
- echo $ui->get_text_input( array(
 
 
 
 
 
401
  'labeltext' => esc_html__( 'Edit Item', 'custom-post-type-ui' ),
402
  'helptext' => esc_html__( 'Used at the top of the post editor screen for an existing post type post.', 'custom-post-type-ui' ),
403
  'namearray' => 'cpt_labels',
404
  'name' => 'edit_item',
405
- 'textvalue' => ( isset( $current['labels']['edit_item'] ) ) ? esc_attr( $current['labels']['edit_item'] ) : '',
406
  'aftertext' => esc_html__( '(e.g. Edit Movie)', 'custom-post-type-ui' ),
407
- ) );
408
-
409
- echo $ui->get_text_input( array(
 
 
 
 
 
410
  'labeltext' => esc_html__( 'New Item', 'custom-post-type-ui' ),
411
  'helptext' => esc_html__( 'Post type label. Used in the admin menu for displaying post types.', 'custom-post-type-ui' ),
412
  'namearray' => 'cpt_labels',
413
  'name' => 'new_item',
414
- 'textvalue' => ( isset( $current['labels']['new_item'] ) ) ? esc_attr( $current['labels']['new_item'] ) : '',
415
  'aftertext' => esc_html__( '(e.g. New Movie)', 'custom-post-type-ui' ),
416
- ) );
417
-
418
- echo $ui->get_text_input( array(
 
 
 
 
 
419
  'labeltext' => esc_html__( 'View Item', 'custom-post-type-ui' ),
420
  'helptext' => esc_html__( 'Used in the admin bar when viewing editor screen for a published post in the post type.', 'custom-post-type-ui' ),
421
  'namearray' => 'cpt_labels',
422
  'name' => 'view_item',
423
- 'textvalue' => ( isset( $current['labels']['view_item'] ) ) ? esc_attr( $current['labels']['view_item'] ) : '',
424
  'aftertext' => esc_html__( '(e.g. View Movie)', 'custom-post-type-ui' ),
425
- ) );
426
-
427
- echo $ui->get_text_input( array(
 
 
 
 
 
428
  'labeltext' => esc_html__( 'View Items', 'custom-post-type-ui' ),
429
  'helptext' => esc_html__( 'Used in the admin bar when viewing editor screen for a published post in the post type.', 'custom-post-type-ui' ),
430
  'namearray' => 'cpt_labels',
431
  'name' => 'view_items',
432
- 'textvalue' => ( isset( $current['labels']['view_items'] ) ) ? esc_attr( $current['labels']['view_items'] ) : '',
433
  'aftertext' => esc_html__( '(e.g. View Movies)', 'custom-post-type-ui' ),
434
- ) );
435
-
436
- echo $ui->get_text_input( array(
 
 
 
 
 
437
  'labeltext' => esc_html__( 'Search Item', 'custom-post-type-ui' ),
438
  'helptext' => esc_html__( 'Used as the text for the search button on post type list screen.', 'custom-post-type-ui' ),
439
  'namearray' => 'cpt_labels',
440
  'name' => 'search_items',
441
- 'textvalue' => ( isset( $current['labels']['search_items'] ) ) ? esc_attr( $current['labels']['search_items'] ) : '',
442
- 'aftertext' => esc_html__( '(e.g. Search Movie)', 'custom-post-type-ui' ),
443
- ) );
444
-
445
- echo $ui->get_text_input( array(
 
 
 
 
 
446
  'labeltext' => esc_html__( 'Not Found', 'custom-post-type-ui' ),
447
  'helptext' => esc_html__( 'Used when there are no posts to display on the post type list screen.', 'custom-post-type-ui' ),
448
  'namearray' => 'cpt_labels',
449
  'name' => 'not_found',
450
- 'textvalue' => ( isset( $current['labels']['not_found'] ) ) ? esc_attr( $current['labels']['not_found'] ) : '',
451
  'aftertext' => esc_html__( '(e.g. No Movies found)', 'custom-post-type-ui' ),
452
- ) );
453
-
454
- echo $ui->get_text_input( array(
 
 
 
 
 
455
  'labeltext' => esc_html__( 'Not Found in Trash', 'custom-post-type-ui' ),
456
  'helptext' => esc_html__( 'Used when there are no posts to display on the post type list trash screen.', 'custom-post-type-ui' ),
457
  'namearray' => 'cpt_labels',
458
  'name' => 'not_found_in_trash',
459
- 'textvalue' => ( isset( $current['labels']['not_found_in_trash'] ) ) ? esc_attr( $current['labels']['not_found_in_trash'] ) : '',
460
  'aftertext' => esc_html__( '(e.g. No Movies found in Trash)', 'custom-post-type-ui' ),
461
- ) );
 
 
 
 
 
462
 
463
  // As of 1.4.0, this will register into `parent_item_colon` paramter upon registration and export.
464
- echo $ui->get_text_input( array(
465
  'labeltext' => esc_html__( 'Parent', 'custom-post-type-ui' ),
466
  'helptext' => esc_html__( 'Used for hierarchical types that need a colon.', 'custom-post-type-ui' ),
467
  'namearray' => 'cpt_labels',
468
  'name' => 'parent',
469
- 'textvalue' => ( isset( $current['labels']['parent'] ) ) ? esc_attr( $current['labels']['parent'] ) : '',
470
  'aftertext' => esc_html__( '(e.g. Parent Movie:)', 'custom-post-type-ui' ),
471
- ) );
472
-
473
- echo $ui->get_text_input( array(
 
 
 
 
 
474
  'labeltext' => esc_html__( 'Featured Image', 'custom-post-type-ui' ),
475
  'helptext' => esc_html__( 'Used as the "Featured Image" phrase for the post type.', 'custom-post-type-ui' ),
476
  'namearray' => 'cpt_labels',
477
  'name' => 'featured_image',
478
- 'textvalue' => ( isset( $current['labels']['featured_image'] ) ) ? esc_attr( $current['labels']['featured_image'] ) : '',
479
  'aftertext' => esc_html__( '(e.g. Featured image for this movie)', 'custom-post-type-ui' ),
480
- ) );
481
-
482
- echo $ui->get_text_input( array(
 
 
 
 
 
483
  'labeltext' => esc_html__( 'Set Featured Image', 'custom-post-type-ui' ),
484
  'helptext' => esc_html__( 'Used as the "Set featured image" phrase for the post type.', 'custom-post-type-ui' ),
485
  'namearray' => 'cpt_labels',
486
  'name' => 'set_featured_image',
487
- 'textvalue' => ( isset( $current['labels']['set_featured_image'] ) ) ? esc_attr( $current['labels']['set_featured_image'] ) : '',
488
  'aftertext' => esc_html__( '(e.g. Set featured image for this movie)', 'custom-post-type-ui' ),
489
- ) );
490
-
491
- echo $ui->get_text_input( array(
 
 
 
 
 
492
  'labeltext' => esc_html__( 'Remove Featured Image', 'custom-post-type-ui' ),
493
  'helptext' => esc_html__( 'Used as the "Remove featured image" phrase for the post type.', 'custom-post-type-ui' ),
494
  'namearray' => 'cpt_labels',
495
  'name' => 'remove_featured_image',
496
- 'textvalue' => ( isset( $current['labels']['remove_featured_image'] ) ) ? esc_attr( $current['labels']['remove_featured_image'] ) : '',
497
  'aftertext' => esc_html__( '(e.g. Remove featured image for this movie)', 'custom-post-type-ui' ),
498
- ) );
499
-
500
- echo $ui->get_text_input( array(
 
 
 
 
 
501
  'labeltext' => esc_html__( 'Use Featured Image', 'custom-post-type-ui' ),
502
  'helptext' => esc_html__( 'Used as the "Use as featured image" phrase for the post type.', 'custom-post-type-ui' ),
503
  'namearray' => 'cpt_labels',
504
  'name' => 'use_featured_image',
505
- 'textvalue' => ( isset( $current['labels']['use_featured_image'] ) ) ? esc_attr( $current['labels']['use_featured_image'] ) : '',
506
  'aftertext' => esc_html__( '(e.g. Use as featured image for this movie)', 'custom-post-type-ui' ),
507
- ) );
508
-
509
- echo $ui->get_text_input( array(
 
 
 
 
 
510
  'labeltext' => esc_html__( 'Archives', 'custom-post-type-ui' ),
511
  'helptext' => esc_html__( 'Post type archive label used in nav menus.', 'custom-post-type-ui' ),
512
  'namearray' => 'cpt_labels',
513
  'name' => 'archives',
514
- 'textvalue' => ( isset( $current['labels']['archives'] ) ) ? esc_attr( $current['labels']['archives'] ) : '',
515
  'aftertext' => esc_html__( '(e.g. Movie archives)', 'custom-post-type-ui' ),
516
- ) );
517
-
518
- echo $ui->get_text_input( array(
 
 
 
 
 
519
  'labeltext' => esc_html__( 'Insert into item', 'custom-post-type-ui' ),
520
  'helptext' => esc_html__( 'Used as the "Insert into post" or "Insert into page" phrase for the post type.', 'custom-post-type-ui' ),
521
  'namearray' => 'cpt_labels',
522
  'name' => 'insert_into_item',
523
- 'textvalue' => ( isset( $current['labels']['insert_into_item'] ) ) ? esc_attr( $current['labels']['insert_into_item'] ) : '',
524
  'aftertext' => esc_html__( '(e.g. Insert into movie)', 'custom-post-type-ui' ),
525
- ) );
526
-
527
- echo $ui->get_text_input( array(
 
 
 
 
 
528
  'labeltext' => esc_html__( 'Uploaded to this Item', 'custom-post-type-ui' ),
529
  'helptext' => esc_html__( 'Used as the "Uploaded to this post" or "Uploaded to this page" phrase for the post type.', 'custom-post-type-ui' ),
530
  'namearray' => 'cpt_labels',
531
  'name' => 'uploaded_to_this_item',
532
- 'textvalue' => ( isset( $current['labels']['uploaded_to_this_item'] ) ) ? esc_attr( $current['labels']['uploaded_to_this_item'] ) : '',
533
  'aftertext' => esc_html__( '(e.g. Uploaded to this movie)', 'custom-post-type-ui' ),
534
- ) );
535
-
536
- echo $ui->get_text_input( array(
 
 
 
 
 
537
  'labeltext' => esc_html__( 'Filter Items List', 'custom-post-type-ui' ),
538
  'helptext' => esc_html__( 'Screen reader text for the filter links heading on the post type listing screen.', 'custom-post-type-ui' ),
539
  'namearray' => 'cpt_labels',
540
  'name' => 'filter_items_list',
541
- 'textvalue' => ( isset( $current['labels']['filter_items_list'] ) ) ? esc_attr( $current['labels']['filter_items_list'] ) : '',
542
  'aftertext' => esc_html__( '(e.g. Filter movies list)', 'custom-post-type-ui' ),
543
- ) );
544
-
545
- echo $ui->get_text_input( array(
 
 
 
 
 
546
  'labeltext' => esc_html__( 'Items List Navigation', 'custom-post-type-ui' ),
547
  'helptext' => esc_html__( 'Screen reader text for the pagination heading on the post type listing screen.', 'custom-post-type-ui' ),
548
  'namearray' => 'cpt_labels',
549
  'name' => 'items_list_navigation',
550
- 'textvalue' => ( isset( $current['labels']['items_list_navigation'] ) ) ? esc_attr( $current['labels']['items_list_navigation'] ) : '',
551
  'aftertext' => esc_html__( '(e.g. Movies list navigation)', 'custom-post-type-ui' ),
552
- ) );
553
-
554
- echo $ui->get_text_input( array(
 
 
 
 
 
555
  'labeltext' => esc_html__( 'Items List', 'custom-post-type-ui' ),
556
  'helptext' => esc_html__( 'Screen reader text for the items list heading on the post type listing screen.', 'custom-post-type-ui' ),
557
  'namearray' => 'cpt_labels',
558
  'name' => 'items_list',
559
- 'textvalue' => ( isset( $current['labels']['items_list'] ) ) ? esc_attr( $current['labels']['items_list'] ) : '',
560
  'aftertext' => esc_html__( '(e.g. Movies list)', 'custom-post-type-ui' ),
561
- ) );
562
-
563
- echo $ui->get_text_input( array(
 
 
 
 
 
564
  'labeltext' => esc_html__( 'Attributes', 'custom-post-type-ui' ),
565
  'helptext' => esc_html__( 'Used for the title of the post attributes meta box.', 'custom-post-type-ui' ),
566
  'namearray' => 'cpt_labels',
567
  'name' => 'attributes',
568
- 'textvalue' => ( isset( $current['labels']['attributes'] ) ) ? esc_attr( $current['labels']['attributes'] ) : '',
569
  'aftertext' => esc_html__( '(e.g. Movies Attributes)', 'custom-post-type-ui' ),
570
- ) );
571
-
572
- echo $ui->get_text_input( array(
 
 
 
 
 
573
  'labeltext' => esc_html__( '"New" menu in admin bar', 'custom-post-type-ui' ),
574
  'helptext' => esc_html__( 'Used in New in Admin menu bar. Default "singular name" label.', 'custom-post-type-ui' ),
575
  'namearray' => 'cpt_labels',
576
  'name' => 'name_admin_bar',
577
- 'textvalue' => ( isset( $current['labels']['name_admin_bar'] ) ) ? esc_attr( $current['labels']['name_admin_bar'] ) : '',
578
  'aftertext' => esc_html__( '(e.g. Movie)', 'custom-post-type-ui' ),
579
- ) );