Custom Post Type UI - Version 1.4.0

Version Description

  • 2016-8-22 =
  • Added: "Export" tab on editor screens for quick access to post type or taxonomy export pages.
  • Added: CPTUI notices are now dismissable via a button on the right side.
  • Added: "Get code" link to registered post types and registered taxonomies listings.
  • Added: More amending of incorrect characters in post type and taxonomy slugs. Latin standard alphabet only. Sorry.
  • Added: New post type template stack reference from recent WordPress versions.
  • Added: Side warning notification if post type or taxonomy slug has been edited.
  • Added: Display About page upon activation of plugin.
  • Added: Link below ads regarding getting them removed via purchase of CPTUI Extended.
  • Added: No need to refresh page after initial save to see post types and taxonomies in menu.
  • Added: Taxonomy support for show_in_menu and show_in_nav_menus.
  • Fixed: Further improved labels for information text on inputs.
  • Fixed: Hide "choose icon" button for non-js users.
  • Fixed: Issue with misused "parent" label key that should be parent_item_colon.
  • Fixed: Missed show_in_menu_string parameter for "get code" area.
  • Fixed: Make sure taxonomies have required post type associated.
  • Fixed: "Edit" links in listings area now account for network-admin when needed, with CPTUI Extended.
  • Updated: Switch to dedicated dashicon for color consistency between applied admin color schemes.
  • Updated: Updated about page.
  • Updated: Further UI refinements to better match WordPress admin. Adapted styles found from metaboxes, including collapse/expand toggles.
Download this release

Release Info

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

Code changes from version 1.3.5 to 1.4.0

classes/class.cptui_admin_ui.php CHANGED
@@ -10,6 +10,8 @@
10
 
11
  /**
12
  * Custom Post Type UI Admin UI
 
 
13
  */
14
  class cptui_admin_ui {
15
 
@@ -100,7 +102,7 @@ class cptui_admin_ui {
100
  $fieldset .= ' ' . $classes;
101
  }
102
 
103
- if ( !empty( $args['aria-expanded'] ) ) {
104
  $fieldset .= ' aria-expanded="' . $args['aria-expanded'] . '"';
105
  }
106
 
@@ -371,9 +373,6 @@ class cptui_admin_ui {
371
  $value .= $this->get_th_start();
372
  $value .= $this->get_label( $args['name'], $args['labeltext'] );
373
  if ( $args['required'] ) { $value .= $this->get_required_span(); }
374
- /*if ( !$args['helptext_after'] ) {
375
- $value .= $this->get_help( $args['helptext'] );
376
- }*/
377
  $value .= $this->get_th_end();
378
  $value .= $this->get_td_start();
379
  }
@@ -498,9 +497,6 @@ class cptui_admin_ui {
498
  $value .= '<input type="checkbox" id="' . $args['name'] . '" name="' . $args['namearray'] . '[]" value="' . $args['checkvalue'] . '" checked="checked" />';
499
  }
500
  $value .= $this->get_label( $args['name'], $args['labeltext'] );
501
- if ( ! empty( $args['helptext'] ) ) {
502
- $value .= $this->get_help( $args['helptext'] );
503
- }
504
  $value .= '<br/>';
505
 
506
  if ( $args['wrap'] ) {
10
 
11
  /**
12
  * Custom Post Type UI Admin UI
13
+ *
14
+ * @since 1.0.0
15
  */
16
  class cptui_admin_ui {
17
 
102
  $fieldset .= ' ' . $classes;
103
  }
104
 
105
+ if ( ! empty( $args['aria-expanded'] ) ) {
106
  $fieldset .= ' aria-expanded="' . $args['aria-expanded'] . '"';
107
  }
108
 
373
  $value .= $this->get_th_start();
374
  $value .= $this->get_label( $args['name'], $args['labeltext'] );
375
  if ( $args['required'] ) { $value .= $this->get_required_span(); }
 
 
 
376
  $value .= $this->get_th_end();
377
  $value .= $this->get_td_start();
378
  }
497
  $value .= '<input type="checkbox" id="' . $args['name'] . '" name="' . $args['namearray'] . '[]" value="' . $args['checkvalue'] . '" checked="checked" />';
498
  }
499
  $value .= $this->get_label( $args['name'], $args['labeltext'] );
 
 
 
500
  $value .= '<br/>';
501
 
502
  if ( $args['wrap'] ) {
classes/class.cptui_debug_info.php CHANGED
@@ -42,13 +42,8 @@ class CPTUI_Debug_Info {
42
 
43
  global $wpdb;
44
 
45
- if ( get_bloginfo( 'version' ) < '3.4' ) {
46
- $theme_data = get_theme_data( get_stylesheet_directory() . '/style.css' );
47
- $theme = $theme_data['Name'] . ' ' . $theme_data['Version'];
48
- } else {
49
- $theme_data = wp_get_theme();
50
- $theme = $theme_data->Name . ' ' . $theme_data->Version;
51
- }
52
 
53
  ob_start();
54
  ?>
@@ -76,13 +71,13 @@ class CPTUI_Debug_Info {
76
  Page For Posts: <?php $id = get_option( 'page_for_posts' );
77
  echo get_the_title( $id ) . ' (#' . $id . ')' . "\n" ?>
78
 
79
- WordPress Memory Limit: <?php echo ( $this->num_convt( WP_MEMORY_LIMIT ) / ( 1024 ) ) . "MB"; ?><?php echo "\n"; ?>
80
 
81
  <?php
82
  $plugins = get_plugins();
83
  $pg_count = count( $plugins );
84
  echo 'TOTAL PLUGINS: ' . $pg_count . "\n\n";
85
- // MU plugins
86
  $mu_plugins = get_mu_plugins();
87
 
88
  if ( $mu_plugins ) :
@@ -93,7 +88,7 @@ class CPTUI_Debug_Info {
93
  echo "\t\t" . $mu_plugin['Name'] . ': ' . $mu_plugin['Version'] . "\n";
94
  }
95
  endif;
96
- // standard plugins - active
97
  echo "\n";
98
 
99
  $active = get_option( 'active_plugins', array() );
@@ -110,7 +105,7 @@ class CPTUI_Debug_Info {
110
 
111
  echo "\t\t" . $plugin['Name'] . ': ' . $plugin['Version'] . "\n";
112
  }
113
- // standard plugins - inactive
114
  echo "\n";
115
  echo "\t\t" , 'INACTIVE PLUGINS: (' . $ic_count . ')' . "\n\n";
116
 
@@ -123,7 +118,7 @@ class CPTUI_Debug_Info {
123
  echo "\t\t" . $plugin['Name'] . ': ' . $plugin['Version'] . "\n";
124
  }
125
 
126
- // if multisite, grab network as well
127
  if ( is_multisite() ) :
128
 
129
  $net_plugins = wp_get_active_network_plugins();
@@ -184,7 +179,7 @@ class CPTUI_Debug_Info {
184
  * @since 1.2.0
185
  * @access public
186
  *
187
- * @param mixed $v
188
  * @return int
189
  */
190
  public function num_convt( $v ) {
@@ -192,11 +187,11 @@ class CPTUI_Debug_Info {
192
  $ret = substr( $v, 0, - 1 );
193
 
194
  switch ( strtoupper( $l ) ) {
195
- case 'P': // fall-through
196
- case 'T': // fall-through
197
- case 'G': // fall-through
198
- case 'M': // fall-through
199
- case 'K': // fall-through
200
  $ret *= 1024;
201
  break;
202
  default:
@@ -238,7 +233,7 @@ class CPTUI_Debug_Info {
238
  home_url( '/' )
239
  ) );
240
 
241
- wp_mail( $args['email'], $subject, $message );
242
 
243
  /**
244
  * Fires after the debug email has been sent.
@@ -246,5 +241,7 @@ class CPTUI_Debug_Info {
246
  * @since 1.3.0
247
  */
248
  do_action( 'cptui_after_debug_email_sent' );
 
 
249
  }
250
  }
42
 
43
  global $wpdb;
44
 
45
+ $theme_data = wp_get_theme();
46
+ $theme = $theme_data->Name . ' ' . $theme_data->Version;
 
 
 
 
 
47
 
48
  ob_start();
49
  ?>
71
  Page For Posts: <?php $id = get_option( 'page_for_posts' );
72
  echo get_the_title( $id ) . ' (#' . $id . ')' . "\n" ?>
73
 
74
+ WordPress Memory Limit: <?php echo ( $this->num_convt( WP_MEMORY_LIMIT ) / ( 1024 ) ) . 'MB'; ?><?php echo "\n"; ?>
75
 
76
  <?php
77
  $plugins = get_plugins();
78
  $pg_count = count( $plugins );
79
  echo 'TOTAL PLUGINS: ' . $pg_count . "\n\n";
80
+ // MU plugins.
81
  $mu_plugins = get_mu_plugins();
82
 
83
  if ( $mu_plugins ) :
88
  echo "\t\t" . $mu_plugin['Name'] . ': ' . $mu_plugin['Version'] . "\n";
89
  }
90
  endif;
91
+ // Standard plugins - active.
92
  echo "\n";
93
 
94
  $active = get_option( 'active_plugins', array() );
105
 
106
  echo "\t\t" . $plugin['Name'] . ': ' . $plugin['Version'] . "\n";
107
  }
108
+ // Standard plugins - inactive.
109
  echo "\n";
110
  echo "\t\t" , 'INACTIVE PLUGINS: (' . $ic_count . ')' . "\n\n";
111
 
118
  echo "\t\t" . $plugin['Name'] . ': ' . $plugin['Version'] . "\n";
119
  }
120
 
121
+ // If multisite, grab network as well.
122
  if ( is_multisite() ) :
123
 
124
  $net_plugins = wp_get_active_network_plugins();
179
  * @since 1.2.0
180
  * @access public
181
  *
182
+ * @param mixed $v Value.
183
  * @return int
184
  */
185
  public function num_convt( $v ) {
187
  $ret = substr( $v, 0, - 1 );
188
 
189
  switch ( strtoupper( $l ) ) {
190
+ case 'P': // Fall-through.
191
+ case 'T': // Fall-through.
192
+ case 'G': // Fall-through.
193
+ case 'M': // Fall-through.
194
+ case 'K': // Fall-through.
195
  $ret *= 1024;
196
  break;
197
  default:
233
  home_url( '/' )
234
  ) );
235
 
236
+ $result = wp_mail( $args['email'], $subject, $message );
237
 
238
  /**
239
  * Fires after the debug email has been sent.
241
  * @since 1.3.0
242
  */
243
  do_action( 'cptui_after_debug_email_sent' );
244
+
245
+ return $result;
246
  }
247
  }
css/cptui.css CHANGED
@@ -1,7 +1,33 @@
 
 
 
 
1
  .posttypesui .cptui-section:first-child, .taxonomiesui .cptui-section:first-child {
2
  margin-top: 30px;
3
  }
4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  .cptui-table #excerpt {
6
  display: inline-block;
7
  height: 16px;
@@ -17,7 +43,7 @@
17
  .cptui-table input[type="text"],
18
  .cptui-new .cptui-table textarea,
19
  .cptui-edit .cptui-table textarea {
20
- width: 50%;
21
  }
22
 
23
  .cptui-table .question:hover {
@@ -33,12 +59,21 @@
33
  margin-top: 15px;
34
  }
35
 
36
- #support .question {
 
 
 
 
 
 
 
 
 
37
  font-size: 18px;
38
  font-weight: bold;
39
  }
40
 
41
- #support .question:before {
42
  content: "\f139";
43
  display: inline-block;
44
  font: normal 25px/1 'dashicons';
@@ -47,19 +82,19 @@
47
  -webkit-font-smoothing: antialiased;
48
  }
49
 
50
- #support .question.active:before {
51
  content: "\f140";
52
  }
53
 
54
- #support .answer {
55
  margin: 10px 0 0 20px;
56
  }
57
 
58
- #support ol li {
59
  list-style: none;
60
  }
61
 
62
- #support li {
63
  position: relative;
64
  }
65
 
@@ -91,14 +126,6 @@
91
  width: 100%;
92
  }
93
 
94
- .one-third {
95
- width: 33%;
96
- }
97
-
98
- .valign {
99
- vertical-align: top;
100
- }
101
-
102
  .about-wrap .cptui-feature {
103
  overflow: visible !important;
104
  *zoom: 1;
@@ -164,17 +191,17 @@
164
  margin: 0 -100px 0 0;
165
  }
166
 
167
- .about-integrations {
168
  background: #fff;
169
  margin: 20px 0;
170
  padding: 1px 20px 10px;
171
  }
172
 
173
- .changelog h4 {
174
  line-height: 1.4;
175
  }
176
 
177
- .cptui-about-text {
178
  margin-bottom: 1em !important;
179
  }
180
 
@@ -242,7 +269,7 @@ fieldset .cptui-help {
242
 
243
  .cptui-section legend {
244
  border: solid #cccccc 1px;
245
- border-bottom: 0px;
246
  font-size: 14px;
247
  font-weight: bold;
248
  padding: 5px;
@@ -266,3 +293,62 @@ fieldset .cptui-help {
266
  clear: left;
267
  margin-bottom: 10px;
268
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .posttypesui, .taxonomiesui {
2
+ width: 75%;
3
+ }
4
+
5
  .posttypesui .cptui-section:first-child, .taxonomiesui .cptui-section:first-child {
6
  margin-top: 30px;
7
  }
8
 
9
+ .posttypesui .postbox-container, .taxonomiesui .postbox-container {
10
+ width: 100%;
11
+ }
12
+
13
+ .posttypesui .postbox .toggle-indicator:before, .taxonomiesui .postbox .toggle-indicator:before {
14
+ content: "\f142";
15
+ display: inline-block;
16
+ font: normal 20px/1 dashicons;
17
+ speak: none;
18
+ -webkit-font-smoothing: antialiased;
19
+ -moz-osx-font-smoothing: grayscale;
20
+ text-decoration: none !important;
21
+ }
22
+
23
+ .posttypesui .postbox.closed .handlediv .toggle-indicator::before, .taxonomiesui .postbox.closed .handlediv .toggle-indicator::before {
24
+ content: "\f140";
25
+ }
26
+
27
+ .posttypesui .postbox .hndle, .taxonomiesui .postbox .hndle {
28
+ cursor: pointer;
29
+ }
30
+
31
  .cptui-table #excerpt {
32
  display: inline-block;
33
  height: 16px;
43
  .cptui-table input[type="text"],
44
  .cptui-new .cptui-table textarea,
45
  .cptui-edit .cptui-table textarea {
46
+ width: 75%;
47
  }
48
 
49
  .cptui-table .question:hover {
59
  margin-top: 15px;
60
  }
61
 
62
+ .cptui-table #slugchanged {
63
+ color: red;
64
+ font-weight: bold;
65
+ }
66
+
67
+ .cptui-table #slugchanged.hidemessage {
68
+ display: none;
69
+ }
70
+
71
+ .cptui-support #support .question {
72
  font-size: 18px;
73
  font-weight: bold;
74
  }
75
 
76
+ .cptui-support #support .question:before {
77
  content: "\f139";
78
  display: inline-block;
79
  font: normal 25px/1 'dashicons';
82
  -webkit-font-smoothing: antialiased;
83
  }
84
 
85
+ .cptui-support #support .question.active:before {
86
  content: "\f140";
87
  }
88
 
89
+ .cptui-support #support .answer {
90
  margin: 10px 0 0 20px;
91
  }
92
 
93
+ .cptui-support #support ol li {
94
  list-style: none;
95
  }
96
 
97
+ .cptui-support #support li {
98
  position: relative;
99
  }
100
 
126
  width: 100%;
127
  }
128
 
 
 
 
 
 
 
 
 
129
  .about-wrap .cptui-feature {
130
  overflow: visible !important;
131
  *zoom: 1;
191
  margin: 0 -100px 0 0;
192
  }
193
 
194
+ .about-wrap .about-integrations {
195
  background: #fff;
196
  margin: 20px 0;
197
  padding: 1px 20px 10px;
198
  }
199
 
200
+ .about-wrap .changelog h4 {
201
  line-height: 1.4;
202
  }
203
 
204
+ .about-wrap .cptui-about-text {
205
  margin-bottom: 1em !important;
206
  }
207
 
269
 
270
  .cptui-section legend {
271
  border: solid #cccccc 1px;
272
+ border-bottom: 0;
273
  font-size: 14px;
274
  font-weight: bold;
275
  padding: 5px;
293
  clear: left;
294
  margin-bottom: 10px;
295
  }
296
+
297
+ .wdspromos-about {
298
+ display: -ms-flexbox;
299
+ display: flex;
300
+ -ms-flex-direction: row;
301
+ flex-direction: row;
302
+ -ms-flex-wrap: nowrap;
303
+ flex-wrap: nowrap;
304
+ -ms-flex-pack: justify;
305
+ justify-content: space-between;
306
+ -ms-flex-line-pack: stretch;
307
+ align-content: stretch;
308
+ -ms-flex-align: start;
309
+ align-items: flex-start;
310
+ margin: 20px 0;
311
+ }
312
+
313
+ .wdspromos-about a:nth-child(1) {
314
+ -ms-flex-order: 0;
315
+ order: 0;
316
+ -ms-flex: 0 1 auto;
317
+ flex: 0 1 auto;
318
+ -ms-flex-item-align: auto;
319
+ align-self: auto;
320
+ }
321
+
322
+ .wdspromos-about a:nth-child(2) {
323
+ -ms-flex-order: 0;
324
+ order: 0;
325
+ -ms-flex: 0 1 auto;
326
+ flex: 0 1 auto;
327
+ -ms-flex-item-align: auto;
328
+ align-self: auto;
329
+ }
330
+
331
+ .wdspromos-about a:nth-child(3) {
332
+ -ms-flex-order: 0;
333
+ order: 0;
334
+ -ms-flex: 0 1 auto;
335
+ flex: 0 1 auto;
336
+ -ms-flex-item-align: auto;
337
+ align-self: auto;
338
+ }
339
+
340
+ .no-js #cptui_choose_icon {
341
+ display: none;
342
+ }
343
+
344
+ .cptui-listings th {
345
+ font-weight: bold;
346
+ }
347
+
348
+ .cptui-listings .post-type-listing th {
349
+ width: 16.66667%;
350
+ }
351
+
352
+ .cptui-listings .taxonomy-listing th {
353
+ width: 20%;
354
+ }
css/cptui.min.css CHANGED
@@ -1 +1 @@
1
- .posttypesui .cptui-section:first-child,.taxonomiesui .cptui-section:first-child{margin-top:30px}.cptui-table #excerpt{display:inline-block;height:16px;margin:12px 4px 12px 0;width:auto}.cptui-table td.outter{vertical-align:top;width:50%}.cptui-edit .cptui-table textarea,.cptui-new .cptui-table textarea,.cptui-table input[type=text]{width:50%}.cptui-table .question:hover{cursor:pointer}.cptui-table th p{font-weight:400;font-size:12px}.cptui-table .cptui-slug-details{margin-top:15px}#support .question{font-size:18px;font-weight:700}#support .question:before{content:"\f139";display:inline-block;font:normal 25px/1 dashicons;margin-left:-25px;position:absolute;-webkit-font-smoothing:antialiased}#support .question.active:before{content:"\f140"}#support .answer{margin:10px 0 0 20px}#support ol li{list-style:none}#support li{position:relative}.required{color:red}.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%}.one-third{width:33%}.valign{vertical-align:top}.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 .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-integrations{background:#fff;margin:20px 0;padding:1px 20px 10px}.changelog h4{line-height:1.4}.cptui-about-text{margin-bottom:1em!important}#togglelabels,.js #cptui_select_post_type input[type=submit],.js #cptui_select_taxonomy input[type=submit]{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}
1
+ .posttypesui,.taxonomiesui{width:75%}.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}.cptui-table #excerpt{display:inline-block;height:16px;margin:12px 4px 12px 0;width:auto}.cptui-table td.outter{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{color:red;font-weight:700}.cptui-table #slugchanged.hidemessage{display:none}.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}.required{color:red}.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 .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}#togglelabels,.js #cptui_select_post_type input[type=submit],.js #cptui_select_taxonomy input[type=submit]{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:nth-child(1),.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;align-self:auto}.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%}
css/cptui.scss CHANGED
@@ -2,6 +2,25 @@
2
  .cptui-section:first-child {
3
  margin-top: 30px;
4
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  }
6
  .cptui-table {
7
  #excerpt {
@@ -17,7 +36,7 @@
17
  input[type="text"],
18
  .cptui-new & textarea,
19
  .cptui-edit & textarea {
20
- width: 50%;
21
  }
22
  .question:hover {
23
  cursor: pointer;
@@ -29,9 +48,17 @@
29
  .cptui-slug-details {
30
  margin-top: 15px;
31
  }
 
 
 
 
 
 
 
 
32
  }
33
 
34
- #support {
35
  .question {
36
  font-size: 18px;
37
  font-weight: bold;
@@ -80,13 +107,6 @@
80
  resize: vertical;
81
  width: 100%;
82
  }
83
- .one-third {
84
- width: 33%;
85
- }
86
- .valign {
87
- vertical-align: top;
88
- }
89
-
90
  .about-wrap {
91
  .cptui-feature {
92
  overflow: visible !important;
@@ -151,18 +171,20 @@
151
  }
152
  }
153
  }
154
- .about-integrations {
155
- background: #fff;
156
- margin: 20px 0;
157
- padding: 1px 20px 10px;
158
- }
159
- .changelog {
160
- h4 {
161
- line-height: 1.4;
 
 
 
 
 
162
  }
163
- }
164
- .cptui-about-text {
165
- margin-bottom: 1em !important;
166
  }
167
  .js {
168
  #cptui_select_post_type input[type='submit'],
@@ -222,26 +244,103 @@
222
  }
223
  legend {
224
  border: solid rgb(204, 204, 204) 1px;
225
- border-bottom: 0px;
226
  font-size: 14px;
227
  font-weight: bold;
228
  padding: 5px;
229
  }
230
  }
231
  .cptui-spacer {
232
- display: block;
233
  margin-top: 25px;
234
  }
235
  .wdspromos {
236
- float: right;
237
- margin-left: 20px;
238
- margin-top: 10px;
239
- width: 275px;
240
 
241
- #mc_embed_signup {
242
- background: #fff;
243
- border: solid rgb(204, 204, 204) 1px;
244
- clear: left;
245
- margin-bottom: 10px;
246
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
247
  }
2
  .cptui-section:first-child {
3
  margin-top: 30px;
4
  }
5
+ width: 75%;
6
+ .postbox-container {
7
+ width: 100%;
8
+ }
9
+ .postbox .toggle-indicator:before {
10
+ content: "\f142";
11
+ display: inline-block;
12
+ font: normal 20px/1 dashicons;
13
+ speak: none;
14
+ -webkit-font-smoothing: antialiased;
15
+ -moz-osx-font-smoothing: grayscale;
16
+ text-decoration: none !important;
17
+ }
18
+ .postbox.closed .handlediv .toggle-indicator::before {
19
+ content: "\f140";
20
+ }
21
+ .postbox .hndle {
22
+ cursor: pointer;
23
+ }
24
  }
25
  .cptui-table {
26
  #excerpt {
36
  input[type="text"],
37
  .cptui-new & textarea,
38
  .cptui-edit & textarea {
39
+ width: 75%;
40
  }
41
  .question:hover {
42
  cursor: pointer;
48
  .cptui-slug-details {
49
  margin-top: 15px;
50
  }
51
+
52
+ #slugchanged {
53
+ color: red;
54
+ font-weight: bold;
55
+ &.hidemessage {
56
+ display: none;
57
+ }
58
+ }
59
  }
60
 
61
+ .cptui-support #support {
62
  .question {
63
  font-size: 18px;
64
  font-weight: bold;
107
  resize: vertical;
108
  width: 100%;
109
  }
 
 
 
 
 
 
 
110
  .about-wrap {
111
  .cptui-feature {
112
  overflow: visible !important;
171
  }
172
  }
173
  }
174
+ .about-wrap {
175
+ .about-integrations {
176
+ background: #fff;
177
+ margin: 20px 0;
178
+ padding: 1px 20px 10px;
179
+ }
180
+ .changelog {
181
+ h4 {
182
+ line-height: 1.4;
183
+ }
184
+ }
185
+ .cptui-about-text {
186
+ margin-bottom: 1em !important;
187
  }
 
 
 
188
  }
189
  .js {
190
  #cptui_select_post_type input[type='submit'],
244
  }
245
  legend {
246
  border: solid rgb(204, 204, 204) 1px;
247
+ border-bottom: 0;
248
  font-size: 14px;
249
  font-weight: bold;
250
  padding: 5px;
251
  }
252
  }
253
  .cptui-spacer {
254
+ display: block;
255
  margin-top: 25px;
256
  }
257
  .wdspromos {
258
+ float: right;
259
+ margin-left: 20px;
260
+ margin-top: 10px;
261
+ width: 275px;
262
 
263
+ #mc_embed_signup {
264
+ background: #fff;
265
+ border: solid rgb(204, 204, 204) 1px;
266
+ clear: left;
267
+ margin-bottom: 10px;
268
+ }
269
+ }
270
+ .wdspromos-about {
271
+ display: -ms-flexbox;
272
+ display: -webkit-flex;
273
+ display: flex;
274
+ -webkit-flex-direction: row;
275
+ -ms-flex-direction: row;
276
+ flex-direction: row;
277
+ -webkit-flex-wrap: nowrap;
278
+ -ms-flex-wrap: nowrap;
279
+ flex-wrap: nowrap;
280
+ -webkit-justify-content: space-between;
281
+ -ms-flex-pack: justify;
282
+ justify-content: space-between;
283
+ -webkit-align-content: stretch;
284
+ -ms-flex-line-pack: stretch;
285
+ align-content: stretch;
286
+ -webkit-align-items: flex-start;
287
+ -ms-flex-align: start;
288
+ align-items: flex-start;
289
+ margin: 20px 0;
290
+
291
+ a:nth-child(1) {
292
+ -webkit-order: 0;
293
+ -ms-flex-order: 0;
294
+ order: 0;
295
+ -webkit-flex: 0 1 auto;
296
+ -ms-flex: 0 1 auto;
297
+ flex: 0 1 auto;
298
+ -webkit-align-self: auto;
299
+ -ms-flex-item-align: auto;
300
+ align-self: auto;
301
+ }
302
+
303
+ a:nth-child(2) {
304
+ -webkit-order: 0;
305
+ -ms-flex-order: 0;
306
+ order: 0;
307
+ -webkit-flex: 0 1 auto;
308
+ -ms-flex: 0 1 auto;
309
+ flex: 0 1 auto;
310
+ -webkit-align-self: auto;
311
+ -ms-flex-item-align: auto;
312
+ align-self: auto;
313
+ }
314
+
315
+ a:nth-child(3) {
316
+ -webkit-order: 0;
317
+ -ms-flex-order: 0;
318
+ order: 0;
319
+ -webkit-flex: 0 1 auto;
320
+ -ms-flex: 0 1 auto;
321
+ flex: 0 1 auto;
322
+ -webkit-align-self: auto;
323
+ -ms-flex-item-align: auto;
324
+ align-self: auto;
325
+ }
326
+ }
327
+ .no-js {
328
+ #cptui_choose_icon {
329
+ display: none
330
+ }
331
+ }
332
+ .cptui-listings {
333
+ th {
334
+ font-weight: bold;
335
+ }
336
+ .post-type-listing {
337
+ th {
338
+ width: 16.66667%;
339
+ }
340
+ }
341
+ .taxonomy-listing {
342
+ th {
343
+ width: 20%;
344
+ }
345
+ }
346
  }
custom-post-type-ui.php CHANGED
@@ -2,6 +2,8 @@
2
  /**
3
  * Custom Post Type UI.
4
  *
 
 
5
  * @package CPTUI
6
  * @subpackage Loader
7
  * @author WebDevStudios
@@ -13,7 +15,7 @@ Plugin Name: Custom Post Type UI
13
  Plugin URI: https://github.com/WebDevStudios/custom-post-type-ui/
14
  Description: Admin panel for creating custom post types and custom taxonomies in WordPress
15
  Author: WebDevStudios
16
- Version: 1.3.5
17
  Author URI: https://webdevstudios.com/
18
  Text Domain: custom-post-type-ui
19
  Domain Path: /languages
@@ -25,8 +27,8 @@ if ( ! defined( 'ABSPATH' ) ) {
25
  exit;
26
  }
27
 
28
- define( 'CPT_VERSION', '1.3.5' ); // Left for legacy purposes.
29
- define( 'CPTUI_VERSION', '1.3.5' );
30
  define( 'CPTUI_WP_VERSION', get_bloginfo( 'version' ) );
31
 
32
  /**
@@ -42,6 +44,52 @@ function cptui_load_ui_class() {
42
  }
43
  add_action( 'init', 'cptui_load_ui_class' );
44
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  /**
46
  * Flush our rewrite rules on deactivation.
47
  *
@@ -179,7 +227,7 @@ function cptui_add_styles() {
179
  }
180
 
181
  $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
182
- wp_register_script( 'cptui', plugins_url( "js/cptui{$min}.js", __FILE__ ), array( 'jquery' ), CPTUI_VERSION, true );
183
  wp_enqueue_style( 'cptui-css', plugins_url( "css/cptui{$min}.css", __FILE__ ), array(), CPTUI_VERSION );
184
  }
185
  add_action( 'admin_enqueue_scripts', 'cptui_add_styles' );
@@ -292,7 +340,11 @@ function cptui_register_single_post_type( $post_type = array() ) {
292
  foreach ( $post_type['labels'] as $key => $label ) {
293
 
294
  if ( ! empty( $label ) ) {
295
- $labels[ $key ] = $label;
 
 
 
 
296
  } elseif ( empty( $label ) && in_array( $key, $preserved ) ) {
297
  $labels[ $key ] = cptui_get_preserved_label( 'post_types', $key, $post_type['label'], $post_type['singular_label'] );
298
  }
@@ -337,6 +389,8 @@ function cptui_register_single_post_type( $post_type = array() ) {
337
  $exclude_from_search = ( false === $public ) ? true : false;
338
  }
339
 
 
 
340
  if ( empty( $post_type['show_in_nav_menus'] ) ) {
341
  // Defaults to value of public.
342
  $post_type['show_in_nav_menus'] = $public;
@@ -355,6 +409,7 @@ function cptui_register_single_post_type( $post_type = array() ) {
355
  'labels' => $labels,
356
  'description' => $post_type['description'],
357
  'public' => get_disp_boolean( $post_type['public'] ),
 
358
  'show_ui' => get_disp_boolean( $post_type['show_ui'] ),
359
  'show_in_nav_menus' => get_disp_boolean( $post_type['show_in_nav_menus'] ),
360
  'has_archive' => $has_archive,
@@ -483,6 +538,10 @@ function cptui_register_single_taxonomy( $taxonomy = array() ) {
483
 
484
  $show_admin_column = ( ! empty( $taxonomy['show_admin_column'] ) && false !== get_disp_boolean( $taxonomy['show_admin_column'] ) ) ? true : false;
485
 
 
 
 
 
486
  $show_in_rest = ( ! empty( $taxonomy['show_in_rest'] ) && false !== get_disp_boolean( $taxonomy['show_in_rest'] ) ) ? true : false;
487
 
488
  $show_in_quick_edit = ( ! empty( $taxonomy['show_in_quick_edit'] ) && false !== get_disp_boolean( $taxonomy['show_in_quick_edit'] ) ) ? true : false;
@@ -499,12 +558,14 @@ function cptui_register_single_taxonomy( $taxonomy = array() ) {
499
  'public' => $public,
500
  'hierarchical' => get_disp_boolean( $taxonomy['hierarchical'] ),
501
  'show_ui' => get_disp_boolean( $taxonomy['show_ui'] ),
 
 
502
  'query_var' => $taxonomy['query_var'],
503
  'rewrite' => $rewrite,
504
  'show_admin_column' => $show_admin_column,
505
  'show_in_rest' => $show_in_rest,
506
  'rest_base' => $rest_base,
507
- 'show_in_quick_edit' => $show_in_quick_edit
508
  );
509
 
510
  $object_type = ( ! empty( $taxonomy['object_types'] ) ) ? $taxonomy['object_types'] : '';
@@ -586,10 +647,10 @@ function cptui_convert_settings() {
586
 
587
  $new_post_types = array();
588
  foreach ( $post_types as $type ) {
589
- $new_post_types[ $type['name'] ] = $type; // This one assigns the # indexes. Named arrays are our friend.
590
- $new_post_types[ $type['name'] ]['supports'] = ( ! empty( $type[0] ) ) ? $type[0] : array(); // Especially for multidimensional arrays.
591
- $new_post_types[ $type['name'] ]['taxonomies'] = ( ! empty( $type[1] ) ) ? $type[1] : array();
592
- $new_post_types[ $type['name'] ]['labels'] = ( ! empty( $type[2] ) ) ? $type[2] : array();
593
  unset(
594
  $new_post_types[ $type['name'] ][0],
595
  $new_post_types[ $type['name'] ][1],
@@ -604,9 +665,9 @@ function cptui_convert_settings() {
604
 
605
  $new_taxonomies = array();
606
  foreach ( $taxonomies as $tax ) {
607
- $new_taxonomies[ $tax['name'] ] = $tax; // Yep, still our friend.
608
- $new_taxonomies[ $tax['name'] ]['labels'] = $tax[0]; // Taxonomies are the only thing with
609
- $new_taxonomies[ $tax['name'] ]['object_types'] = $tax[1]; // "tax" in the name that I like.
610
  unset(
611
  $new_taxonomies[ $tax['name'] ][0],
612
  $new_taxonomies[ $tax['name'] ][1]
@@ -637,10 +698,12 @@ add_action( 'admin_init', 'cptui_convert_settings' );
637
  */
638
  function cptui_admin_notices( $action = '', $object_type = '', $success = true, $custom = '' ) {
639
 
640
- $class = ( $success ) ? 'updated' : 'error';
 
 
641
  $object_type = esc_attr( $object_type );
642
 
643
- $messagewrapstart = '<div id="message" class="' . $class . '"><p>';
644
  $message = '';
645
 
646
  $messagewrapend = '</p></div>';
2
  /**
3
  * Custom Post Type UI.
4
  *
5
+ * For all your post type and taxonomy needs.
6
+ *
7
  * @package CPTUI
8
  * @subpackage Loader
9
  * @author WebDevStudios
15
  Plugin URI: https://github.com/WebDevStudios/custom-post-type-ui/
16
  Description: Admin panel for creating custom post types and custom taxonomies in WordPress
17
  Author: WebDevStudios
18
+ Version: 1.4.0
19
  Author URI: https://webdevstudios.com/
20
  Text Domain: custom-post-type-ui
21
  Domain Path: /languages
27
  exit;
28
  }
29
 
30
+ define( 'CPT_VERSION', '1.4.0' ); // Left for legacy purposes.
31
+ define( 'CPTUI_VERSION', '1.4.0' );
32
  define( 'CPTUI_WP_VERSION', get_bloginfo( 'version' ) );
33
 
34
  /**
44
  }
45
  add_action( 'init', 'cptui_load_ui_class' );
46
 
47
+ /**
48
+ * Set a transient used for redirection upon activation.
49
+ *
50
+ * @since 1.4.0
51
+ */
52
+ function cptui_activation_redirect() {
53
+ // Bail if activating from network, or bulk.
54
+ if ( isset( $_GET['activate-multi'] ) ) {
55
+ return;
56
+ }
57
+
58
+ // Add the transient to redirect.
59
+ set_transient( 'cptui_activation_redirect', true, 30 );
60
+ }
61
+ add_action( 'activate_' . plugin_basename( __FILE__ ), 'cptui_activation_redirect' );
62
+
63
+ /**
64
+ * Redirect user to CPTUI about page upon plugin activation.
65
+ *
66
+ * @since 1.4.0
67
+ */
68
+ function cptui_make_activation_redirect() {
69
+
70
+ if ( ! get_transient( 'cptui_activation_redirect' ) ) {
71
+ return;
72
+ }
73
+
74
+ delete_transient( 'cptui_activation_redirect' );
75
+
76
+ // Bail if activating from network, or bulk.
77
+ if ( isset( $_GET['activate-multi'] ) ) {
78
+ return;
79
+ }
80
+
81
+ $query_args = array( 'page' => 'cptui_main_menu' );
82
+
83
+ // Redirect to CPTUI about page.
84
+ wp_safe_redirect(
85
+ add_query_arg(
86
+ $query_args,
87
+ cptui_admin_url( 'admin.php?page=cptui_main_menu' )
88
+ )
89
+ );
90
+ }
91
+ add_action( 'admin_init', 'cptui_make_activation_redirect', 1 );
92
+
93
  /**
94
  * Flush our rewrite rules on deactivation.
95
  *
227
  }
228
 
229
  $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
230
+ wp_register_script( 'cptui', plugins_url( "js/cptui{$min}.js", __FILE__ ), array( 'jquery', 'postbox' ), CPTUI_VERSION, true );
231
  wp_enqueue_style( 'cptui-css', plugins_url( "css/cptui{$min}.css", __FILE__ ), array(), CPTUI_VERSION );
232
  }
233
  add_action( 'admin_enqueue_scripts', 'cptui_add_styles' );
340
  foreach ( $post_type['labels'] as $key => $label ) {
341
 
342
  if ( ! empty( $label ) ) {
343
+ if ( 'parent' === $key ) {
344
+ $labels['parent_item_colon'] = $label;
345
+ } else {
346
+ $labels[ $key ] = $label;
347
+ }
348
  } elseif ( empty( $label ) && in_array( $key, $preserved ) ) {
349
  $labels[ $key ] = cptui_get_preserved_label( 'post_types', $key, $post_type['label'], $post_type['singular_label'] );
350
  }
389
  $exclude_from_search = ( false === $public ) ? true : false;
390
  }
391
 
392
+ $queryable = ( ! empty( $post_type['publicly_queryable'] ) && isset( $post_type['publicly_queryable'] ) ) ? get_disp_boolean( $post_type['publicly_queryable'] ) : $public;
393
+
394
  if ( empty( $post_type['show_in_nav_menus'] ) ) {
395
  // Defaults to value of public.
396
  $post_type['show_in_nav_menus'] = $public;
409
  'labels' => $labels,
410
  'description' => $post_type['description'],
411
  'public' => get_disp_boolean( $post_type['public'] ),
412
+ 'publicly_queryable' => $queryable,
413
  'show_ui' => get_disp_boolean( $post_type['show_ui'] ),
414
  'show_in_nav_menus' => get_disp_boolean( $post_type['show_in_nav_menus'] ),
415
  'has_archive' => $has_archive,
538
 
539
  $show_admin_column = ( ! empty( $taxonomy['show_admin_column'] ) && false !== get_disp_boolean( $taxonomy['show_admin_column'] ) ) ? true : false;
540
 
541
+ $show_in_menu = ( ! empty( $taxonomy['show_in_menu'] ) && false !== get_disp_boolean( $taxonomy['show_in_menu'] ) ) ? true : false;
542
+
543
+ $show_in_nav_menus = ( ! empty( $taxonomy['show_in_nav_menus'] ) && false !== get_disp_boolean( $taxonomy['show_in_nav_menus'] ) ) ? true : false;
544
+
545
  $show_in_rest = ( ! empty( $taxonomy['show_in_rest'] ) && false !== get_disp_boolean( $taxonomy['show_in_rest'] ) ) ? true : false;
546
 
547
  $show_in_quick_edit = ( ! empty( $taxonomy['show_in_quick_edit'] ) && false !== get_disp_boolean( $taxonomy['show_in_quick_edit'] ) ) ? true : false;
558
  'public' => $public,
559
  'hierarchical' => get_disp_boolean( $taxonomy['hierarchical'] ),
560
  'show_ui' => get_disp_boolean( $taxonomy['show_ui'] ),
561
+ 'show_in_menu' => $show_in_menu,
562
+ 'show_in_nav_menus' => $show_in_nav_menus,
563
  'query_var' => $taxonomy['query_var'],
564
  'rewrite' => $rewrite,
565
  'show_admin_column' => $show_admin_column,
566
  'show_in_rest' => $show_in_rest,
567
  'rest_base' => $rest_base,
568
+ 'show_in_quick_edit' => $show_in_quick_edit,
569
  );
570
 
571
  $object_type = ( ! empty( $taxonomy['object_types'] ) ) ? $taxonomy['object_types'] : '';
647
 
648
  $new_post_types = array();
649
  foreach ( $post_types as $type ) {
650
+ $new_post_types[ $type['name'] ] = $type; // This one assigns the # indexes. Named arrays are our friend.
651
+ $new_post_types[ $type['name'] ]['supports'] = ( ! empty( $type[0] ) ) ? $type[0] : array(); // Especially for multidimensional arrays.
652
+ $new_post_types[ $type['name'] ]['taxonomies'] = ( ! empty( $type[1] ) ) ? $type[1] : array();
653
+ $new_post_types[ $type['name'] ]['labels'] = ( ! empty( $type[2] ) ) ? $type[2] : array();
654
  unset(
655
  $new_post_types[ $type['name'] ][0],
656
  $new_post_types[ $type['name'] ][1],
665
 
666
  $new_taxonomies = array();
667
  foreach ( $taxonomies as $tax ) {
668
+ $new_taxonomies[ $tax['name'] ] = $tax; // Yep, still our friend.
669
+ $new_taxonomies[ $tax['name'] ]['labels'] = $tax[0]; // Taxonomies are the only thing with
670
+ $new_taxonomies[ $tax['name'] ]['object_types'] = $tax[1]; // "tax" in the name that I like.
671
  unset(
672
  $new_taxonomies[ $tax['name'] ][0],
673
  $new_taxonomies[ $tax['name'] ][1]
698
  */
699
  function cptui_admin_notices( $action = '', $object_type = '', $success = true, $custom = '' ) {
700
 
701
+ $class = array();
702
+ $class[] = ( $success ) ? 'updated' : 'error';
703
+ $class[] = 'notice is-dismissible';
704
  $object_type = esc_attr( $object_type );
705
 
706
+ $messagewrapstart = '<div id="message" class="' . implode( ' ', $class ) . '"><p>';
707
  $message = '';
708
 
709
  $messagewrapend = '</p></div>';
images/professional-wordpress-plugin-development.png DELETED
Binary file
images/professional-wordpress-thirdedition.jpg DELETED
Binary file
inc/about.php CHANGED
@@ -20,7 +20,8 @@ if ( ! defined( 'ABSPATH' ) ) {
20
  *
21
  * @internal
22
  */
23
- function cptui_settings() { ?>
 
24
  <div class="wrap about-wrap">
25
  <?php
26
 
@@ -30,7 +31,7 @@ function cptui_settings() { ?>
30
  * @since 1.0.0
31
  */
32
  do_action( 'cptui_main_page_start' ); ?>
33
- <h1><?php _e( 'Custom Post Type UI', 'custom-post-type-ui' ); ?> <?php echo CPTUI_VERSION; ?></h1>
34
 
35
  <?php
36
 
@@ -43,15 +44,29 @@ function cptui_settings() { ?>
43
  ?>
44
 
45
  <div class="about-text cptui-about-text">
46
- <?php _e( 'Thank you for choosing Custom Post Type UI. We hope that your experience with our plugin provides efficiency and speed in creating post types and taxonomies, to better organize your content, without having to touch code.', 'custom-post-type-ui' ); ?>
47
  </div>
48
- <h2><?php printf( __( 'What\'s new in version %s', 'custom-post-type-ui' ), CPTUI_VERSION ); ?></h2>
 
 
 
 
 
 
 
 
 
49
  <div class="changelog about-integrations">
50
  <div class="cptui-feature feature-section col three-col">
51
  <div>
52
- <h2><?php _e( 'Evolved UI for Custom Post Type UI', 'custom-post-type-ui' ); ?></h2>
53
- <p><?php _e( 'We have further revised our UI for post type and taxonomy parameter screens. Better separation of required and optional settings was a primary goal as well as user flow through the screen.' ) ?></p>
 
 
 
 
54
  </div>
 
55
  <div>
56
  <h2><?php _e( 'Slug prevention measures', 'custom-post-type-ui' ); ?></h2>
57
  <p><?php _e( 'We added measures on the post type and taxonomy slug inputs to prevent using characters that should not be used in slugs. This is primarily for when adding new post types and taxonomies, but will also affect when editing existing options. Do not hesitate to contact support if you are experiencing issues.' ) ?></p>
@@ -60,17 +75,9 @@ function cptui_settings() { ?>
60
  <h2><?php _e( 'Improved rewrite rules flushing', 'custom-post-type-ui' ); ?></h2>
61
  <p><?php _e( 'We improved what we do after registering a new post type or taxonomy to better prevent having to manually flush rewrite rules.' ) ?></p>
62
  </div>
63
- <div>
64
- <h2><?php _e( 'Continued accessibility improvements', 'custom-post-type-ui' ); ?></h2>
65
- <p><?php _e( 'We have continued working on the accessibility of the plugin, building off what we accomplished in previous releases. If you have feedback on where it could be further improved, let us know.') ?></p>
66
- </div>
67
- <div>
68
- <h2><?php _e( 'More parameter and label support', 'custom-post-type-ui' ); ?></h2>
69
- <p><?php _e( 'We have added more parameters as well as recently added labels for greater customization of your post type and taxonomy settings.', 'custom-post-type-ui' ); ?></p>
70
- </div>
71
  <div class="last-feature">
72
- <h2><?php _e( 'Default "supports" for post types', 'custom-post-type-ui' ); ?></h2>
73
- <p><?php _e( 'The "Title", "Editor", and "Featured Image" checkboxes are now checked by default when adding a new post type.', 'custom-post-type-ui' ); ?></p>
74
  </div>
75
  </div>
76
  </div>
@@ -90,44 +97,91 @@ function cptui_settings() { ?>
90
  }
91
 
92
  /**
93
- * Outputs the Donation content on the about page.
94
  *
95
- * @since 1.3.0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
  *
97
  * @internal
98
  */
99
- function cptui_donation_content() { ?>
100
- <h1><?php _e( 'Help Support This Plugin!', 'custom-post-type-ui' ); ?></h1>
101
- <table border="0">
102
- <tr>
103
- <td class="one-third valign">
104
- <h2><?php _e( 'Professional WordPress<br />Third Edition', 'custom-post-type-ui' ); ?></h2>
105
- <a href="http://bit.ly/prowp3" target="_blank">
106
- <img src="<?php echo plugins_url( '/images/professional-wordpress-thirdedition.jpg', dirname( __FILE__ ) ); ?>" width="200" alt="<?php esc_attr_e( 'Professional WordPress Design and Development book cover.', 'custom-post-type-ui' ); ?>">
107
- </a>
108
- <br />
109
- <p><?php _e( 'The leading book on WordPress design and development! Brand new third edition!', 'custom-post-type-ui' ); ?></p>
110
- </td>
111
- <td class="one-third valign">
112
- <h2><?php _e( 'Professional WordPress<br />Plugin Development', 'custom-post-type-ui' ); ?></h2>
113
- <a href="http://amzn.to/plugindevbook" target="_blank">
114
- <img src="<?php echo plugins_url( '/images/professional-wordpress-plugin-development.png', dirname( __FILE__ ) ); ?>" width="200" alt="<?php esc_attr_e( 'Professional WordPress Plugin Development book cover.', 'custom-post-type-ui' ); ?>">
115
- </a>
116
- <br />
117
- <p><?php _e( 'Highest rated WordPress development book on Amazon!', 'custom-post-type-ui' ); ?></p>
118
- </td>
119
- <td class="one-third valign">
120
- <h2><?php _e( 'PayPal Donation', 'custom-post-type-ui' ); ?></h2>
121
- <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
122
- <input type="hidden" name="cmd" value="_s-xclick">
123
- <input type="hidden" name="hosted_button_id" value="YJEDXPHE49Q3U">
124
- <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" name="submit" alt="<?php esc_attr_e( 'PayPal - The safer, easier way to pay online!', 'custom-post-type-ui' ); ?>">
125
- <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
126
- </form>
127
- <p><?php _e( 'Please donate to the development of Custom Post Type UI:', 'custom-post-type-ui' ); ?></p>
128
- </td>
129
- </tr>
130
- </table>
 
 
 
 
131
  <?php
132
  }
133
- add_action( 'cptui_main_page_extra_notes', 'cptui_donation_content', 10 );
20
  *
21
  * @internal
22
  */
23
+ function cptui_settings() {
24
+ ?>
25
  <div class="wrap about-wrap">
26
  <?php
27
 
31
  * @since 1.0.0
32
  */
33
  do_action( 'cptui_main_page_start' ); ?>
34
+ <h1><?php esc_html_e( 'Custom Post Type UI', 'custom-post-type-ui' ); ?> <?php echo CPTUI_VERSION; ?></h1>
35
 
36
  <?php
37
 
44
  ?>
45
 
46
  <div class="about-text cptui-about-text">
47
+ <?php esc_html_e( 'Thank you for choosing Custom Post Type UI! We hope that your experience with our plugin makes creating post types and taxonomies and organizing your content quick and easy.', 'custom-post-type-ui' ); ?>
48
  </div>
49
+
50
+ <?php
51
+ /**
52
+ * Fires before the About Page changelog.
53
+ *
54
+ * @since 1.4.0
55
+ */
56
+ do_action( 'cptui_main_page_before_changelog' ); ?>
57
+
58
+ <h2><?php printf( esc_html__( 'What\'s new in version %s', 'custom-post-type-ui' ), CPTUI_VERSION ); ?></h2>
59
  <div class="changelog about-integrations">
60
  <div class="cptui-feature feature-section col three-col">
61
  <div>
62
+ <h2><?php esc_html_e( 'Evolved UI for Custom Post Type UI', 'custom-post-type-ui' ); ?></h2>
63
+ <p><?php esc_html_e( 'Once again we have evolved the UI for post type and taxonomy parameter screens. We strive to adhere to familiar WordPress admin familiarity and have adapted styles and UX applied to WordPress metaboxes.' ) ?></p>
64
+ </div>
65
+ <div>
66
+ <h2><?php esc_html_e( 'Eliminated page refresh need.', 'custom-post-type-ui' ); ?></h2>
67
+ <p><?php esc_html_e( 'Previously, due to how settings were saved, there was need for an extra refresh for newly saved settings to be applied to a post type or taxonomy. Under the hood, we have amended the saving process in order to remove need to trigger a refresh to see applied changes.' ) ?></p>
68
  </div>
69
+ <h2><?php esc_html_e( 'From our previous release:', 'custom-post-type-ui' ); ?></h2>
70
  <div>
71
  <h2><?php _e( 'Slug prevention measures', 'custom-post-type-ui' ); ?></h2>
72
  <p><?php _e( 'We added measures on the post type and taxonomy slug inputs to prevent using characters that should not be used in slugs. This is primarily for when adding new post types and taxonomies, but will also affect when editing existing options. Do not hesitate to contact support if you are experiencing issues.' ) ?></p>
75
  <h2><?php _e( 'Improved rewrite rules flushing', 'custom-post-type-ui' ); ?></h2>
76
  <p><?php _e( 'We improved what we do after registering a new post type or taxonomy to better prevent having to manually flush rewrite rules.' ) ?></p>
77
  </div>
 
 
 
 
 
 
 
 
78
  <div class="last-feature">
79
+ <h2><?php _e( 'Continued accessibility improvements', 'custom-post-type-ui' ); ?></h2>
80
+ <p><?php _e( 'We have continued working on the accessibility of the plugin, building off what we accomplished in previous releases. If you have feedback on where it could be further improved, let us know.' ) ?></p>
81
  </div>
82
  </div>
83
  </div>
97
  }
98
 
99
  /**
100
+ * Display Pluginize-based content.
101
  *
102
+ * @since 1.4.0
103
+ */
104
+ function cptui_pluginize_content() {
105
+ echo '<h1>' . sprintf( esc_html__( 'More from %s', 'custom-post-type-ui' ), 'WebDevStudios' ) . '</h1>';
106
+ echo '<div class="wdspromos-about">';
107
+ $ads = cptui_get_ads();
108
+ if ( ! empty( $ads ) ) {
109
+
110
+ foreach ( $ads as $ad ) {
111
+
112
+ $the_ad = sprintf(
113
+ '<img src="%s" alt="%s">',
114
+ esc_attr( $ad['image'] ),
115
+ esc_attr( $ad['text'] )
116
+ );
117
+
118
+ // Escaping $the_ad breaks the html.
119
+ printf(
120
+ '<p><a href="%s">%s</a></p>',
121
+ esc_url( $ad['url'] ),
122
+ $the_ad
123
+ );
124
+ }
125
+ }
126
+ echo '</div>';
127
+ }
128
+ add_action( 'cptui_main_page_extra_notes', 'cptui_pluginize_content', 9 );
129
+
130
+ /**
131
+ * Render our newsletter form for the about page.
132
+ *
133
+ * @since 1.4.0
134
+ */
135
+ function cptui_about_page_newsletter() {
136
+ ?>
137
+ <h3><?php esc_html_e( 'Stay informed', 'custom-post-type-ui' ); ?></h3>
138
+ <?php
139
+ cptui_about_page_newsletter_form();
140
+ }
141
+ add_action( 'cptui_main_page_before_changelog', 'cptui_about_page_newsletter' );
142
+
143
+ /**
144
+ * Outputs our newsletter signup form.
145
+ *
146
+ * @since 1.4.0
147
  *
148
  * @internal
149
  */
150
+ function cptui_about_page_newsletter_form() {
151
+ ?>
152
+ <!-- Begin MailChimp Signup Form -->
153
+ <link href="//cdn-images.mailchimp.com/embedcode/classic-10_7.css" rel="stylesheet" type="text/css">
154
+ <div id="mc_embed_signup">
155
+ <form action="//webdevstudios.us1.list-manage.com/subscribe/post?u=67169b098c99de702c897d63e&amp;id=9cb1c7472e" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
156
+ <div id="mc_embed_signup_scroll">
157
+
158
+ <p>
159
+ <strong><?php esc_html_e( 'Wanna make the most of WordPress? Sign up for the Pluginize newsletter and get access to discounts, plugin announcements, and more!', 'custom-post-type-ui' ); ?></strong>
160
+ </p>
161
+ <div class="mc-field-group">
162
+ <label for="mce-EMAIL"><?php esc_html_e( 'Email Address', 'custom-post-type-ui' ); ?></label>
163
+ <input tabindex="-1" type="email" value="" name="EMAIL" class="required email" id="mce-EMAIL">
164
+ </div>
165
+ <div id="mce-responses" class="clear">
166
+ <div class="response" id="mce-error-response" style="display:none"></div>
167
+ <div class="response" id="mce-success-response" style="display:none"></div>
168
+ </div> <!-- real people should not fill this in and expect good things - do not remove this or risk form bot signups-->
169
+ <div style="position: absolute; left: -5000px;" aria-hidden="true">
170
+ <input type="text" name="b_67169b098c99de702c897d63e_9cb1c7472e" tabindex="-1" value=""></div>
171
+ <div class="clear">
172
+ <input type="submit" value="<?php esc_attr_e( 'Subscribe', 'custom-post-type-ui' ); ?>" name="subscribe" id="mc-embedded-subscribe" class="button" tabindex="-1">
173
+ </div>
174
+ </div>
175
+ </form>
176
+ </div>
177
+ <script type='text/javascript' src='//s3.amazonaws.com/downloads.mailchimp.com/js/mc-validate.js'></script>
178
+ <script type='text/javascript'>(function ($) {
179
+ window.fnames = new Array();
180
+ window.ftypes = new Array();
181
+ fnames[0] = 'EMAIL';
182
+ ftypes[0] = 'email';
183
+ }(jQuery));
184
+ var $mcj = jQuery.noConflict(true);</script>
185
+ <!--End mc_embed_signup-->
186
  <?php
187
  }
 
inc/import_export.php CHANGED
@@ -35,28 +35,28 @@ function cptui_importexport_tabs( $tabs = array(), $current_page = '' ) {
35
  'text' => __( 'Post Types', 'custom-post-type-ui' ),
36
  'classes' => $classes,
37
  'url' => cptui_admin_url( 'admin.php?page=cptui_' . $current_page ),
38
- 'aria-selected' => 'false'
39
  );
40
 
41
  $tabs['tabs']['taxonomies'] = array(
42
  'text' => __( 'Taxonomies', 'custom-post-type-ui' ),
43
  'classes' => $classes,
44
  'url' => esc_url( add_query_arg( array( 'action' => 'taxonomies' ), cptui_admin_url( 'admin.php?page=cptui_' . $current_page ) ) ),
45
- 'aria-selected' => 'false'
46
  );
47
 
48
  $tabs['tabs']['get_code'] = array(
49
  'text' => __( 'Get Code', 'custom-post-type-ui' ),
50
  'classes' => $classes,
51
  'url' => esc_url( add_query_arg( array( 'action' => 'get_code' ), cptui_admin_url( 'admin.php?page=cptui_' . $current_page ) ) ),
52
- 'aria-selected' => 'false'
53
  );
54
 
55
  $tabs['tabs']['debuginfo'] = array(
56
  'text' => __( 'Debug Info', 'custom-post-type-ui' ),
57
  'classes' => $classes,
58
  'url' => esc_url( add_query_arg( array( 'action' => 'debuginfo' ), cptui_admin_url( 'admin.php?page=cptui_' . $current_page ) ) ),
59
- 'aria-selected' => 'false'
60
  );
61
 
62
  $active_class = 'nav-tab-active';
@@ -88,25 +88,23 @@ add_filter( 'cptui_get_tabs', 'cptui_importexport_tabs', 10, 2 );
88
  * @since 1.0.0
89
  *
90
  * @internal
91
- *
92
- * @return string HTML output for the page.
93
  */
94
  function cptui_importexport() {
95
 
96
  $tab = '';
97
- if ( !empty( $_GET ) ) {
98
- if ( !empty( $_GET['action'] ) && 'taxonomies' == $_GET['action'] ) {
99
  $tab = 'taxonomies';
100
- } elseif ( !empty( $_GET['action'] ) && 'get_code' == $_GET['action'] ) {
101
  $tab = 'get_code';
102
- } elseif ( !empty( $_GET['action'] ) && 'debuginfo' == $_GET['action'] ) {
103
  $tab = 'debuginfo';
104
  } else {
105
  $tab = 'post_types';
106
  }
107
  }
108
 
109
- if ( !empty( $_POST ) ) {
110
  $notice = cptui_import_types_taxes_settings( $_POST );
111
  }
112
 
@@ -150,17 +148,17 @@ function cptui_importexport() {
150
  * @param bool $single Whether or not we are rendering a single taxonomy.
151
  */
152
  function cptui_get_taxonomy_code( $cptui_taxonomies = array(), $single = false ) {
153
- if ( !empty( $cptui_taxonomies ) ) {
154
  $callback = 'cptui_register_my_taxes';
155
  if ( $single ) {
156
  $key = key( $cptui_taxonomies );
157
- $callback = 'cptui_register_my_taxes_' . str_replace('-', '_', $cptui_taxonomies[ $key ]['name'] );
158
  }
159
  ?>
160
  add_action( 'init', '<?php echo $callback; ?>' );
161
  function <?php echo $callback; ?>() {
162
  <?php
163
- foreach( $cptui_taxonomies as $tax ) {
164
  echo cptui_get_single_taxonomy_registery( $tax ) . "\n";
165
  } ?>
166
  // End <?php echo $callback; ?>()
@@ -189,23 +187,23 @@ function cptui_get_single_taxonomy_registery( $taxonomy = array() ) {
189
  $rewrite = disp_boolean( $taxonomy['rewrite'] );
190
 
191
  $rewrite_slug = ' \'slug\' => \'' . $taxonomy['name'] . '\',';
192
- if ( !empty( $taxonomy['rewrite_slug'] ) ) {
193
  $rewrite_slug = ' \'slug\' => \'' . $taxonomy['rewrite_slug'] . '\',';
194
  }
195
 
196
  $rewrite_withfront = '';
197
  $withfront = disp_boolean( $taxonomy['rewrite_withfront'] );
198
- if ( !empty( $withfront ) ) {
199
- $rewrite_withfront = ' \'with_front\' => ' . $withfront . ' ';
200
  }
201
 
202
- $hierarchical = ( !empty( $taxonomy['rewrite_hierarchical'] ) ) ? disp_boolean( $taxonomy['rewrite_hierarchical'] ) : '';
203
  $rewrite_hierarchcial = '';
204
- if ( !empty( $hierarchical ) ) {
205
- $rewrite_hierarchcial = ' \'hierarchical\' => ' . $hierarchical . ' ';
206
  }
207
 
208
- if ( !empty( $taxonomy['rewrite_slug'] ) || false !== disp_boolean( $taxonomy['rewrite_withfront'] ) ) {
209
  $rewrite_start = 'array(';
210
  $rewrite_end = ')';
211
 
@@ -215,6 +213,7 @@ function cptui_get_single_taxonomy_registery( $taxonomy = array() ) {
215
  $rewrite = disp_boolean( $taxonomy['rewrite'] );
216
  }
217
  $public = ( isset( $taxonomy['public'] ) ) ? disp_boolean( $taxonomy['public'] ) : 'true';
 
218
 
219
  $my_theme = wp_get_theme();
220
  $textdomain = $my_theme->get( 'TextDomain' );
@@ -222,8 +221,9 @@ function cptui_get_single_taxonomy_registery( $taxonomy = array() ) {
222
  $labels = array(
223
  "name" => __( '<?php echo $taxonomy['label']; ?>', '<?php echo $textdomain; ?>' ),
224
  "singular_name" => __( '<?php echo $taxonomy['singular_label']; ?>', '<?php echo $textdomain; ?>' ),
225
- <?php foreach( $taxonomy['labels'] as $key => $label ) {
226
- if ( !empty( $label ) ) {
 
227
  echo '"' . $key . '" => __( \'' . $label . '\', \'' . $textdomain . '\' ),' . "\n\t\t";
228
  }
229
  } ?>);
@@ -235,14 +235,15 @@ function cptui_get_single_taxonomy_registery( $taxonomy = array() ) {
235
  "hierarchical" => <?php echo $taxonomy['hierarchical']; ?>,
236
  "label" => "<?php echo $taxonomy['label']; ?>",
237
  "show_ui" => <?php echo disp_boolean( $taxonomy['show_ui'] ); ?>,
 
 
238
  "query_var" => <?php echo disp_boolean( $taxonomy['query_var'] );?>,
239
  "rewrite" => <?php echo $rewrite; ?>,
240
  "show_admin_column" => <?php echo $taxonomy['show_admin_column']; ?>,
241
  "show_in_rest" => <?php echo disp_boolean( $taxonomy['show_in_rest'] ); ?>,
242
  "rest_base" => "<?php echo $taxonomy['rest_base']; ?>",
243
- "show_in_quick_edit" => <?php echo disp_boolean( $taxonomy['show_in_quick_edit'] ); ?>,
244
  );
245
- <?php // register_taxonomy( $taxonomy, $object_type, $args ); NEED TO DETERMINE THE $object_type. ?>
246
  register_taxonomy( "<?php echo $taxonomy['name']; ?>", <?php echo $post_types; ?>, $args );
247
  <?php
248
  }
@@ -256,11 +257,10 @@ function cptui_get_single_taxonomy_registery( $taxonomy = array() ) {
256
  *
257
  * @param array $cptui_post_types Array of post types to render.
258
  * @param bool $single Whether or not we are rendering a single post type.
259
- * @return string Post type registration text for use elsewhere.
260
  */
261
  function cptui_get_post_type_code( $cptui_post_types = array(), $single = false ) {
262
  // Whitespace very much matters here, thus why it's all flush against the left side.
263
- if ( !empty( $cptui_post_types ) ) {
264
  $callback = 'cptui_register_my_cpts';
265
  if ( $single ) {
266
  $key = key( $cptui_post_types );
@@ -269,8 +269,8 @@ function cptui_get_post_type_code( $cptui_post_types = array(), $single = false
269
  ?>
270
  add_action( 'init', '<?php echo $callback; ?>' );
271
  function <?php echo $callback; ?>() {
272
- <?php // space before this line reflects in textarea.
273
- foreach( $cptui_post_types as $type ) {
274
  echo cptui_get_single_post_type_registery( $type ) . "\n";
275
  } ?>
276
  // End of <?php echo $callback; ?>()
@@ -287,7 +287,6 @@ function <?php echo $callback; ?>() {
287
  * @since 1.0.0
288
  *
289
  * @param array $post_type Post type data to output.
290
- * @return string Copy/paste ready "php" code.
291
  */
292
  function cptui_get_single_post_type_registery( $post_type = array() ) {
293
 
@@ -314,34 +313,33 @@ function cptui_get_single_post_type_registery( $post_type = array() ) {
314
  }
315
 
316
  $rewrite_withfront = '';
317
- $rewrite = get_disp_boolean( $post_type['rewrite' ] );
318
  if ( false !== $rewrite ) {
319
  $rewrite = disp_boolean( $post_type['rewrite'] );
320
 
321
  $rewrite_slug = ' "slug" => "' . $post_type['name'] . '",';
322
- if ( !empty( $post_type['rewrite_slug'] ) ) {
323
  $rewrite_slug = ' "slug" => "' . $post_type['rewrite_slug'] . '",';
324
  }
325
 
326
  $withfront = disp_boolean( $post_type['rewrite_withfront'] );
327
- if ( !empty( $withfront ) ) {
328
  $rewrite_withfront = ' "with_front" => ' . $withfront . ' ';
329
  }
330
 
331
- if ( !empty( $post_type['rewrite_slug'] ) || !empty( $post_type['rewrite_withfront'] ) ) {
332
  $rewrite_start = 'array(';
333
  $rewrite_end = ')';
334
 
335
  $rewrite = $rewrite_start . $rewrite_slug . $rewrite_withfront . $rewrite_end;
336
  }
337
-
338
  } else {
339
  $rewrite = disp_boolean( $post_type['rewrite'] );
340
  }
341
 
342
  $supports = '';
343
  // Do a little bit of php work to get these into strings.
344
- if ( !empty( $post_type['supports'] ) && is_array( $post_type['supports'] ) ) {
345
  $supports = 'array( "' . implode( '", "', $post_type['supports'] ) . '" )';
346
  }
347
 
@@ -350,14 +348,14 @@ function cptui_get_single_post_type_registery( $post_type = array() ) {
350
  }
351
 
352
  $taxonomies = '';
353
- if ( !empty( $post_type['taxonomies'] ) && is_array( $post_type['taxonomies'] ) ) {
354
  $taxonomies = 'array( "' . implode( '", "', $post_type['taxonomies'] ) . '" )';
355
  }
356
 
357
  if ( in_array( $post_type['query_var'], array( 'true', 'false', '0', '1' ) ) ) {
358
  $post_type['query_var'] = disp_boolean( $post_type['query_var'] );
359
  }
360
- if ( !empty( $post_type['query_var_slug'] ) ) {
361
  $post_type['query_var'] = '"' . $post_type['query_var_slug'] . '"';
362
  }
363
 
@@ -373,9 +371,14 @@ function cptui_get_single_post_type_registery( $post_type = array() ) {
373
  $labels = array(
374
  "name" => __( '<?php echo $post_type['label']; ?>', '<?php echo $textdomain; ?>' ),
375
  "singular_name" => __( '<?php echo $post_type['singular_label']; ?>', '<?php echo $textdomain; ?>' ),
376
- <?php foreach( $post_type['labels'] as $key => $label ) {
377
- if ( !empty( $label ) ) {
378
- echo '"' . $key . '" => __( \'' . $label . '\', \'' . $textdomain . '\' ),' . "\n\t\t";
 
 
 
 
 
379
  }
380
  } ?>);
381
 
@@ -384,21 +387,26 @@ function cptui_get_single_post_type_registery( $post_type = array() ) {
384
  "labels" => $labels,
385
  "description" => "<?php echo $post_type['description']; ?>",
386
  "public" => <?php echo disp_boolean( $post_type['public'] ); ?>,
 
387
  "show_ui" => <?php echo disp_boolean( $post_type['show_ui'] ); ?>,
388
  "show_in_rest" => <?php echo disp_boolean( $post_type['show_in_rest'] ); ?>,
389
  "rest_base" => "<?php echo $post_type['rest_base']; ?>",
390
  "has_archive" => <?php echo disp_boolean( $post_type['has_archive'] ); ?>,
391
  "show_in_menu" => <?php echo disp_boolean( $post_type['show_in_menu'] ); ?>,
 
 
392
  "exclude_from_search" => <?php echo disp_boolean( $post_type['exclude_from_search'] ); ?>,
393
  "capability_type" => "<?php echo $post_type['capability_type']; ?>",
394
  "map_meta_cap" => <?php echo disp_boolean( $post_type['map_meta_cap'] ); ?>,
395
  "hierarchical" => <?php echo disp_boolean( $post_type['hierarchical'] ); ?>,
396
  "rewrite" => <?php echo $rewrite; ?>,
397
  "query_var" => <?php echo $post_type['query_var']; ?>,
398
- <?php if ( !empty( $post_type['menu_position'] ) ) { ?>"menu_position" => <?php echo $post_type['menu_position']; ?>,<?php } ?><?php if ( !empty( $post_type['menu_icon'] ) ) { ?>"menu_icon" => "<?php echo $post_type['menu_icon']; ?>",<?php } ?>
399
- <?php if ( !empty( $supports ) ) { echo "\n\t\t" ?>"supports" => <?php echo $supports; ?>,<?php } ?>
400
- <?php if ( !empty( $taxonomies ) ) { echo "\n\t\t" ?>"taxonomies" => <?php echo $taxonomies; ?>,<?php } ?>
401
- <?php if ( true === $yarpp ) { echo "\n\t\t" ?>"yarpp_support" => <?php echo disp_boolean( $yarpp ); ?><?php } echo "\n";?>
 
 
402
  );
403
  register_post_type( "<?php echo $post_type['name']; ?>", $args );
404
  <?php
@@ -415,7 +423,7 @@ function cptui_get_single_post_type_registery( $post_type = array() ) {
415
  * @return mixed false on nothing to do, otherwise void.
416
  */
417
  function cptui_import_types_taxes_settings( $postdata = array() ) {
418
- if ( !isset( $postdata['cptui_post_import'] ) && !isset( $postdata['cptui_tax_import'] ) ) {
419
  return false;
420
  }
421
 
@@ -451,7 +459,7 @@ function cptui_import_types_taxes_settings( $postdata = array() ) {
451
  $postdata['cptui_tax_import'] = $third_party_taxonomy_data;
452
  }
453
 
454
- if ( !empty( $postdata['cptui_post_import'] ) ) {
455
  $cpt_data = stripslashes_deep( trim( $postdata['cptui_post_import'] ) );
456
  $settings = json_decode( $cpt_data, true );
457
 
@@ -498,7 +506,7 @@ function cptui_import_types_taxes_settings( $postdata = array() ) {
498
  set_transient( 'cptui_flush_rewrite_rules', 'true', 5 * 60 );
499
  return cptui_admin_notices( 'import', __( 'Post types', 'custom-post-type-ui' ), $success );
500
 
501
- } elseif ( !empty( $postdata['cptui_tax_import'] ) ) {
502
  $tax_data = stripslashes_deep( trim( $postdata['cptui_tax_import'] ) );
503
  $settings = json_decode( $tax_data, true );
504
 
@@ -543,7 +551,7 @@ function cptui_import_types_taxes_settings( $postdata = array() ) {
543
  // Used to help flush rewrite rules on init.
544
  set_transient( 'cptui_flush_rewrite_rules', 'true', 5 * 60 );
545
  return cptui_admin_notices( 'import', __( 'Taxonomies', 'custom-post-type-ui' ), $success );
546
- }
547
 
548
  return $success;
549
  }
@@ -560,10 +568,14 @@ function cptui_render_posttypes_taxonomies_section() {
560
 
561
  <p><?php _e( 'If you are wanting to migrate registered post types or taxonomies from this site to another, that will also use Custom Post Type UI, use the import and export functionality. If you are moving away from Custom Post Type UI, use the information in the "Get Code" tab.', 'custom-post-type-ui' ); ?></p>
562
 
563
- <p><?php printf( '<strong>%s</strong>: %s',
564
- __( 'NOTE', 'custom-post-type-ui' ),
565
- __( 'This will not export the associated posts or taxonomy terms, just the settings.', 'custom-post-type-ui' )
566
- ); ?>
 
 
 
 
567
  </p>
568
  <table class="form-table cptui-table">
569
  <?php if ( ! empty( $_GET ) && empty( $_GET['action'] ) ) { ?>
@@ -665,10 +677,10 @@ function cptui_render_getcode_section() {
665
  <textarea name="cptui_post_type_get_code" id="cptui_post_type_get_code" class="cptui_post_type_get_code" onclick="this.focus();this.select()" onfocus="this.focus();this.select();" readonly="readonly" aria-readonly="true"><?php cptui_get_post_type_code( $cptui_post_types ); ?></textarea>
666
 
667
  <?php
668
- if ( !empty( $cptui_post_types ) ) {
669
  foreach ( $cptui_post_types as $post_type ) { ?>
670
- <h2><?php
671
- $type = ( !empty( $post_type['label'] ) ) ? $post_type['label'] : $post_type['name'];
672
  printf( __( '%s Post Type', 'custom-post-type-ui' ), $type ); ?></h2>
673
  <label for="cptui_post_type_get_code_<?php echo $post_type['name']; ?>"><?php _e( 'Copy/paste the code below into your functions.php file.', 'custom-post-type-ui' ); ?></label>
674
  <textarea name="cptui_post_type_get_code_<?php echo $post_type['name']; ?>" id="cptui_post_type_get_code_<?php echo $post_type['name']; ?>" class="cptui_post_type_get_code" onclick="this.focus();this.select()" onfocus="this.focus();this.select();" readonly="readonly" aria-readonly="true"><?php cptui_get_post_type_code( array( $post_type ), true ); ?></textarea>
@@ -684,7 +696,7 @@ function cptui_render_getcode_section() {
684
  <?php
685
  if ( ! empty( $cptui_taxonomies ) ) {
686
  foreach ( $cptui_taxonomies as $taxonomy ) { ?>
687
- <h2><?php
688
  $tax = ( ! empty( $taxonomy['label'] ) ) ? $taxonomy['label'] : $taxonomy['name'];
689
  printf( __( '%s Taxonomy', 'custom-post-type-ui' ), $tax ); ?></h2>
690
  <label for="cptui_tax_get_code_<?php echo $taxonomy['name']; ?>"><?php _e( 'Copy/paste the code below into your functions.php file.', 'custom-post-type-ui' ); ?></label>
35
  'text' => __( 'Post Types', 'custom-post-type-ui' ),
36
  'classes' => $classes,
37
  'url' => cptui_admin_url( 'admin.php?page=cptui_' . $current_page ),
38
+ 'aria-selected' => 'false',
39
  );
40
 
41
  $tabs['tabs']['taxonomies'] = array(
42
  'text' => __( 'Taxonomies', 'custom-post-type-ui' ),
43
  'classes' => $classes,
44
  'url' => esc_url( add_query_arg( array( 'action' => 'taxonomies' ), cptui_admin_url( 'admin.php?page=cptui_' . $current_page ) ) ),
45
+ 'aria-selected' => 'false',
46
  );
47
 
48
  $tabs['tabs']['get_code'] = array(
49
  'text' => __( 'Get Code', 'custom-post-type-ui' ),
50
  'classes' => $classes,
51
  'url' => esc_url( add_query_arg( array( 'action' => 'get_code' ), cptui_admin_url( 'admin.php?page=cptui_' . $current_page ) ) ),
52
+ 'aria-selected' => 'false',
53
  );
54
 
55
  $tabs['tabs']['debuginfo'] = array(
56
  'text' => __( 'Debug Info', 'custom-post-type-ui' ),
57
  'classes' => $classes,
58
  'url' => esc_url( add_query_arg( array( 'action' => 'debuginfo' ), cptui_admin_url( 'admin.php?page=cptui_' . $current_page ) ) ),
59
+ 'aria-selected' => 'false',
60
  );
61
 
62
  $active_class = 'nav-tab-active';
88
  * @since 1.0.0
89
  *
90
  * @internal
 
 
91
  */
92
  function cptui_importexport() {
93
 
94
  $tab = '';
95
+ if ( ! empty( $_GET ) ) {
96
+ if ( ! empty( $_GET['action'] ) && 'taxonomies' == $_GET['action'] ) {
97
  $tab = 'taxonomies';
98
+ } elseif ( ! empty( $_GET['action'] ) && 'get_code' == $_GET['action'] ) {
99
  $tab = 'get_code';
100
+ } elseif ( ! empty( $_GET['action'] ) && 'debuginfo' == $_GET['action'] ) {
101
  $tab = 'debuginfo';
102
  } else {
103
  $tab = 'post_types';
104
  }
105
  }
106
 
107
+ if ( ! empty( $_POST ) ) {
108
  $notice = cptui_import_types_taxes_settings( $_POST );
109
  }
110
 
148
  * @param bool $single Whether or not we are rendering a single taxonomy.
149
  */
150
  function cptui_get_taxonomy_code( $cptui_taxonomies = array(), $single = false ) {
151
+ if ( ! empty( $cptui_taxonomies ) ) {
152
  $callback = 'cptui_register_my_taxes';
153
  if ( $single ) {
154
  $key = key( $cptui_taxonomies );
155
+ $callback = 'cptui_register_my_taxes_' . str_replace( '-', '_', $cptui_taxonomies[ $key ]['name'] );
156
  }
157
  ?>
158
  add_action( 'init', '<?php echo $callback; ?>' );
159
  function <?php echo $callback; ?>() {
160
  <?php
161
+ foreach ( $cptui_taxonomies as $tax ) {
162
  echo cptui_get_single_taxonomy_registery( $tax ) . "\n";
163
  } ?>
164
  // End <?php echo $callback; ?>()
187
  $rewrite = disp_boolean( $taxonomy['rewrite'] );
188
 
189
  $rewrite_slug = ' \'slug\' => \'' . $taxonomy['name'] . '\',';
190
+ if ( ! empty( $taxonomy['rewrite_slug'] ) ) {
191
  $rewrite_slug = ' \'slug\' => \'' . $taxonomy['rewrite_slug'] . '\',';
192
  }
193
 
194
  $rewrite_withfront = '';
195
  $withfront = disp_boolean( $taxonomy['rewrite_withfront'] );
196
+ if ( ! empty( $withfront ) ) {
197
+ $rewrite_withfront = ' \'with_front\' => ' . $withfront . ', ';
198
  }
199
 
200
+ $hierarchical = ( ! empty( $taxonomy['rewrite_hierarchical'] ) ) ? disp_boolean( $taxonomy['rewrite_hierarchical'] ) : '';
201
  $rewrite_hierarchcial = '';
202
+ if ( ! empty( $hierarchical ) ) {
203
+ $rewrite_hierarchcial = ' \'hierarchical\' => ' . $hierarchical . ', ';
204
  }
205
 
206
+ if ( ! empty( $taxonomy['rewrite_slug'] ) || false !== disp_boolean( $taxonomy['rewrite_withfront'] ) ) {
207
  $rewrite_start = 'array(';
208
  $rewrite_end = ')';
209
 
213
  $rewrite = disp_boolean( $taxonomy['rewrite'] );
214
  }
215
  $public = ( isset( $taxonomy['public'] ) ) ? disp_boolean( $taxonomy['public'] ) : 'true';
216
+ $show_in_quick_edit = ( isset( $taxonomy['show_in_quick_edit'] ) ) ? disp_boolean( $taxonomy['show_in_quick_edit'] ) : disp_boolean( $taxonomy['show_ui'] );
217
 
218
  $my_theme = wp_get_theme();
219
  $textdomain = $my_theme->get( 'TextDomain' );
221
  $labels = array(
222
  "name" => __( '<?php echo $taxonomy['label']; ?>', '<?php echo $textdomain; ?>' ),
223
  "singular_name" => __( '<?php echo $taxonomy['singular_label']; ?>', '<?php echo $textdomain; ?>' ),
224
+ <?php
225
+ foreach ( $taxonomy['labels'] as $key => $label ) {
226
+ if ( ! empty( $label ) ) {
227
  echo '"' . $key . '" => __( \'' . $label . '\', \'' . $textdomain . '\' ),' . "\n\t\t";
228
  }
229
  } ?>);
235
  "hierarchical" => <?php echo $taxonomy['hierarchical']; ?>,
236
  "label" => "<?php echo $taxonomy['label']; ?>",
237
  "show_ui" => <?php echo disp_boolean( $taxonomy['show_ui'] ); ?>,
238
+ "show_in_menu" => <?php echo disp_boolean( $taxonomy['show_in_menu'] ); ?>,
239
+ "show_in_nav_menus" => <?php echo disp_boolean( $taxonomy['show_in_nav_menus'] ); ?>,
240
  "query_var" => <?php echo disp_boolean( $taxonomy['query_var'] );?>,
241
  "rewrite" => <?php echo $rewrite; ?>,
242
  "show_admin_column" => <?php echo $taxonomy['show_admin_column']; ?>,
243
  "show_in_rest" => <?php echo disp_boolean( $taxonomy['show_in_rest'] ); ?>,
244
  "rest_base" => "<?php echo $taxonomy['rest_base']; ?>",
245
+ "show_in_quick_edit" => <?php echo $show_in_quick_edit; ?>,
246
  );
 
247
  register_taxonomy( "<?php echo $taxonomy['name']; ?>", <?php echo $post_types; ?>, $args );
248
  <?php
249
  }
257
  *
258
  * @param array $cptui_post_types Array of post types to render.
259
  * @param bool $single Whether or not we are rendering a single post type.
 
260
  */
261
  function cptui_get_post_type_code( $cptui_post_types = array(), $single = false ) {
262
  // Whitespace very much matters here, thus why it's all flush against the left side.
263
+ if ( ! empty( $cptui_post_types ) ) {
264
  $callback = 'cptui_register_my_cpts';
265
  if ( $single ) {
266
  $key = key( $cptui_post_types );
269
  ?>
270
  add_action( 'init', '<?php echo $callback; ?>' );
271
  function <?php echo $callback; ?>() {
272
+ <?php // Space before this line reflects in textarea.
273
+ foreach ( $cptui_post_types as $type ) {
274
  echo cptui_get_single_post_type_registery( $type ) . "\n";
275
  } ?>
276
  // End of <?php echo $callback; ?>()
287
  * @since 1.0.0
288
  *
289
  * @param array $post_type Post type data to output.
 
290
  */
291
  function cptui_get_single_post_type_registery( $post_type = array() ) {
292
 
313
  }
314
 
315
  $rewrite_withfront = '';
316
+ $rewrite = get_disp_boolean( $post_type['rewrite'] );
317
  if ( false !== $rewrite ) {
318
  $rewrite = disp_boolean( $post_type['rewrite'] );
319
 
320
  $rewrite_slug = ' "slug" => "' . $post_type['name'] . '",';
321
+ if ( ! empty( $post_type['rewrite_slug'] ) ) {
322
  $rewrite_slug = ' "slug" => "' . $post_type['rewrite_slug'] . '",';
323
  }
324
 
325
  $withfront = disp_boolean( $post_type['rewrite_withfront'] );
326
+ if ( ! empty( $withfront ) ) {
327
  $rewrite_withfront = ' "with_front" => ' . $withfront . ' ';
328
  }
329
 
330
+ if ( ! empty( $post_type['rewrite_slug'] ) || ! empty( $post_type['rewrite_withfront'] ) ) {
331
  $rewrite_start = 'array(';
332
  $rewrite_end = ')';
333
 
334
  $rewrite = $rewrite_start . $rewrite_slug . $rewrite_withfront . $rewrite_end;
335
  }
 
336
  } else {
337
  $rewrite = disp_boolean( $post_type['rewrite'] );
338
  }
339
 
340
  $supports = '';
341
  // Do a little bit of php work to get these into strings.
342
+ if ( ! empty( $post_type['supports'] ) && is_array( $post_type['supports'] ) ) {
343
  $supports = 'array( "' . implode( '", "', $post_type['supports'] ) . '" )';
344
  }
345
 
348
  }
349
 
350
  $taxonomies = '';
351
+ if ( ! empty( $post_type['taxonomies'] ) && is_array( $post_type['taxonomies'] ) ) {
352
  $taxonomies = 'array( "' . implode( '", "', $post_type['taxonomies'] ) . '" )';
353
  }
354
 
355
  if ( in_array( $post_type['query_var'], array( 'true', 'false', '0', '1' ) ) ) {
356
  $post_type['query_var'] = disp_boolean( $post_type['query_var'] );
357
  }
358
+ if ( ! empty( $post_type['query_var_slug'] ) ) {
359
  $post_type['query_var'] = '"' . $post_type['query_var_slug'] . '"';
360
  }
361
 
371
  $labels = array(
372
  "name" => __( '<?php echo $post_type['label']; ?>', '<?php echo $textdomain; ?>' ),
373
  "singular_name" => __( '<?php echo $post_type['singular_label']; ?>', '<?php echo $textdomain; ?>' ),
374
+ <?php foreach ( $post_type['labels'] as $key => $label ) {
375
+ if ( ! empty( $label ) ) {
376
+ if ( 'parent' === $key ) {
377
+ // Fix for incorrect label key. See #439.
378
+ echo '"' . 'parent_item_colon' . '" => __( \'' . $label . '\', \'' . $textdomain . '\' ),' . "\n\t\t";
379
+ } else {
380
+ echo '"' . $key . '" => __( \'' . $label . '\', \'' . $textdomain . '\' ),' . "\n\t\t";
381
+ }
382
  }
383
  } ?>);
384
 
387
  "labels" => $labels,
388
  "description" => "<?php echo $post_type['description']; ?>",
389
  "public" => <?php echo disp_boolean( $post_type['public'] ); ?>,
390
+ "publicly_queryable" => <?php echo disp_boolean( $post_type['publicly_queryable'] ); ?>,
391
  "show_ui" => <?php echo disp_boolean( $post_type['show_ui'] ); ?>,
392
  "show_in_rest" => <?php echo disp_boolean( $post_type['show_in_rest'] ); ?>,
393
  "rest_base" => "<?php echo $post_type['rest_base']; ?>",
394
  "has_archive" => <?php echo disp_boolean( $post_type['has_archive'] ); ?>,
395
  "show_in_menu" => <?php echo disp_boolean( $post_type['show_in_menu'] ); ?>,
396
+ <?php if ( ! empty( $post_type['show_in_menu_string'] ) ) { ?>"show_in_menu_string" => "<?php echo $post_type['show_in_menu_string']; ?>",
397
+ <?php } ?>
398
  "exclude_from_search" => <?php echo disp_boolean( $post_type['exclude_from_search'] ); ?>,
399
  "capability_type" => "<?php echo $post_type['capability_type']; ?>",
400
  "map_meta_cap" => <?php echo disp_boolean( $post_type['map_meta_cap'] ); ?>,
401
  "hierarchical" => <?php echo disp_boolean( $post_type['hierarchical'] ); ?>,
402
  "rewrite" => <?php echo $rewrite; ?>,
403
  "query_var" => <?php echo $post_type['query_var']; ?>,
404
+ <?php if ( ! empty( $post_type['menu_position'] ) ) { ?>"menu_position" => <?php echo $post_type['menu_position']; ?>,<?php } ?><?php if ( ! empty( $post_type['menu_icon'] ) ) { ?>"menu_icon" => "<?php echo $post_type['menu_icon']; ?>",<?php } ?>
405
+ <?php if ( ! empty( $supports ) ) { echo "\n\t\t" ?>"supports" => <?php echo $supports; ?>,<?php } ?>
406
+ <?php if ( ! empty( $taxonomies ) ) { echo "\n\t\t" ?>"taxonomies" => <?php echo $taxonomies; ?>,
407
+ <?php } ?>
408
+ <?php if ( true === $yarpp ) { echo "\n\t\t" ?>"yarpp_support" => <?php echo disp_boolean( $yarpp ); ?>,
409
+ <?php } ?>
410
  );
411
  register_post_type( "<?php echo $post_type['name']; ?>", $args );
412
  <?php
423
  * @return mixed false on nothing to do, otherwise void.
424
  */
425
  function cptui_import_types_taxes_settings( $postdata = array() ) {
426
+ if ( ! isset( $postdata['cptui_post_import'] ) && ! isset( $postdata['cptui_tax_import'] ) ) {
427
  return false;
428
  }
429
 
459
  $postdata['cptui_tax_import'] = $third_party_taxonomy_data;
460
  }
461
 
462
+ if ( ! empty( $postdata['cptui_post_import'] ) ) {
463
  $cpt_data = stripslashes_deep( trim( $postdata['cptui_post_import'] ) );
464
  $settings = json_decode( $cpt_data, true );
465
 
506
  set_transient( 'cptui_flush_rewrite_rules', 'true', 5 * 60 );
507
  return cptui_admin_notices( 'import', __( 'Post types', 'custom-post-type-ui' ), $success );
508
 
509
+ } elseif ( ! empty( $postdata['cptui_tax_import'] ) ) {
510
  $tax_data = stripslashes_deep( trim( $postdata['cptui_tax_import'] ) );
511
  $settings = json_decode( $tax_data, true );
512
 
551
  // Used to help flush rewrite rules on init.
552
  set_transient( 'cptui_flush_rewrite_rules', 'true', 5 * 60 );
553
  return cptui_admin_notices( 'import', __( 'Taxonomies', 'custom-post-type-ui' ), $success );
554
+ }
555
 
556
  return $success;
557
  }
568
 
569
  <p><?php _e( 'If you are wanting to migrate registered post types or taxonomies from this site to another, that will also use Custom Post Type UI, use the import and export functionality. If you are moving away from Custom Post Type UI, use the information in the "Get Code" tab.', 'custom-post-type-ui' ); ?></p>
570
 
571
+ <p>
572
+ <?php
573
+ printf(
574
+ '<strong>%s</strong>: %s',
575
+ __( 'NOTE', 'custom-post-type-ui' ),
576
+ __( 'This will not export the associated posts or taxonomy terms, just the settings.', 'custom-post-type-ui' )
577
+ );
578
+ ?>
579
  </p>
580
  <table class="form-table cptui-table">
581
  <?php if ( ! empty( $_GET ) && empty( $_GET['action'] ) ) { ?>
677
  <textarea name="cptui_post_type_get_code" id="cptui_post_type_get_code" class="cptui_post_type_get_code" onclick="this.focus();this.select()" onfocus="this.focus();this.select();" readonly="readonly" aria-readonly="true"><?php cptui_get_post_type_code( $cptui_post_types ); ?></textarea>
678
 
679
  <?php
680
+ if ( ! empty( $cptui_post_types ) ) {
681
  foreach ( $cptui_post_types as $post_type ) { ?>
682
+ <h2 id="<?php echo esc_attr( $post_type['name'] ); ?>"><?php
683
+ $type = ( ! empty( $post_type['label'] ) ) ? $post_type['label'] : $post_type['name'];
684
  printf( __( '%s Post Type', 'custom-post-type-ui' ), $type ); ?></h2>
685
  <label for="cptui_post_type_get_code_<?php echo $post_type['name']; ?>"><?php _e( 'Copy/paste the code below into your functions.php file.', 'custom-post-type-ui' ); ?></label>
686
  <textarea name="cptui_post_type_get_code_<?php echo $post_type['name']; ?>" id="cptui_post_type_get_code_<?php echo $post_type['name']; ?>" class="cptui_post_type_get_code" onclick="this.focus();this.select()" onfocus="this.focus();this.select();" readonly="readonly" aria-readonly="true"><?php cptui_get_post_type_code( array( $post_type ), true ); ?></textarea>
696
  <?php
697
  if ( ! empty( $cptui_taxonomies ) ) {
698
  foreach ( $cptui_taxonomies as $taxonomy ) { ?>
699
+ <h2 id="<?php echo esc_attr( $taxonomy['name'] ); ?>"><?php
700
  $tax = ( ! empty( $taxonomy['label'] ) ) ? $taxonomy['label'] : $taxonomy['name'];
701
  printf( __( '%s Taxonomy', 'custom-post-type-ui' ), $tax ); ?></h2>
702
  <label for="cptui_tax_get_code_<?php echo $taxonomy['name']; ?>"><?php _e( 'Copy/paste the code below into your functions.php file.', 'custom-post-type-ui' ); ?></label>
inc/listings.php CHANGED
@@ -22,7 +22,7 @@ if ( ! defined( 'ABSPATH' ) ) {
22
  */
23
  function cptui_listings() {
24
  ?>
25
- <div class="wrap">
26
  <?php
27
  /**
28
  * Fires right inside the wrap div for the listings screen.
@@ -38,7 +38,7 @@ function cptui_listings() {
38
  echo '<h2 id="post-types">' . esc_html__( 'Post Types', 'custom-post-type-ui' ) . '</h2>';
39
  if ( ! empty( $post_types ) ) {
40
  ?>
41
- <p><?php printf( esc_html__( 'Total count: %d', 'custom-post-type-ui' ), count( $post_types ) ); ?></p>
42
 
43
  <?php
44
 
@@ -58,7 +58,7 @@ function cptui_listings() {
58
  */
59
  do_action( 'cptui_before_post_type_listing' );
60
  ?>
61
- <table class="wp-list-table widefat">
62
  <tr>
63
  <?php
64
  foreach ( $post_type_table_heads as $head ) {
@@ -100,10 +100,24 @@ function cptui_listings() {
100
  }
101
  ?>
102
  <tr class="<?php echo esc_attr( $rowclass ); ?>">
103
- <?php $post_type_link_url = admin_url( 'admin.php?page=cptui_manage_post_types&action=edit&cptui_post_type=' . $post_type ); ?>
104
- <td><a href="<?php echo esc_attr( $post_type_link_url ); ?>"><?php printf( esc_html__( 'Edit %s', 'custom-post-type-ui' ), esc_html( $post_type ) ); ?></a>
105
- <?php if ( $archive ) { ?>
106
- |
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
  <a href="<?php echo esc_attr( get_post_type_archive_link( $post_type ) ); ?>"><?php esc_html_e( 'View frontend archive', 'custom-post-type-ui' ); ?></a>
108
  <?php } ?>
109
  </td>
@@ -136,6 +150,9 @@ function cptui_listings() {
136
  $maybe_empty = array_filter( $post_type_settings['labels'] );
137
  if ( ! empty( $maybe_empty ) ) {
138
  foreach ( $post_type_settings['labels'] as $key => $value ) {
 
 
 
139
  printf(
140
  '%s: %s<br/>',
141
  esc_html( $key ),
@@ -155,12 +172,17 @@ function cptui_listings() {
155
  </p>
156
 
157
  <p><strong><?php esc_html_e( 'Single Posts file name examples.', 'custom-post-type-ui' ); ?></strong><br/>
 
158
  single-<?php echo esc_html( $post_type ); ?>.php<br/>
159
  single.php<br/>
160
- singular.php(WP 4.3+)<br/>
161
  index.php
162
  </p>
163
 
 
 
 
 
164
  <p><?php
165
  printf(
166
  '<a href="https://developer.wordpress.org/themes/basics/template-hierarchy/">%s</a>',
@@ -198,11 +220,11 @@ function cptui_listings() {
198
  do_action( 'cptui_no_post_types_listing' );
199
  }
200
 
201
- $taxonomies = cptui_get_taxonomy_data( 'cptui_taxonomies' );
202
  echo '<h2 id="taxonomies">' . esc_html__( 'Taxonomies', 'custom-post-type-ui' ) . '</h2>';
203
  if ( ! empty( $taxonomies ) ) {
204
  ?>
205
- <p><?php printf( esc_html__( 'Total count: %d', 'custom-post-type-ui' ), count( $taxonomies ) ); ?></p>
206
 
207
  <?php
208
 
@@ -221,7 +243,7 @@ function cptui_listings() {
221
  */
222
  do_action( 'cptui_before_taxonomy_listing' );
223
  ?>
224
- <table class="wp-list-table widefat">
225
  <tr>
226
  <?php
227
  foreach ( $taxonomy_table_heads as $head ) {
@@ -257,9 +279,20 @@ function cptui_listings() {
257
  }
258
  ?>
259
  <tr class="<?php echo esc_attr( $rowclass ); ?>">
260
- <?php $taxonomy_link_url = admin_url( 'admin.php?page=cptui_manage_taxonomies&action=edit&cptui_taxonomy=' . $taxonomy ); ?>
261
- <td><a href="<?php echo esc_attr( $taxonomy_link_url ); ?>"><?php echo esc_html( $taxonomy ); ?></a><br/><hr/>
262
- <a href="<?php echo esc_attr( $taxonomy_link_url ); ?>"><?php printf( esc_html__( 'Edit %s', 'custom-post-type-ui' ), esc_html( $taxonomy ) ); ?></a>
 
 
 
 
 
 
 
 
 
 
 
263
  </td>
264
  <td>
265
  <?php
22
  */
23
  function cptui_listings() {
24
  ?>
25
+ <div class="wrap cptui-listings">
26
  <?php
27
  /**
28
  * Fires right inside the wrap div for the listings screen.
38
  echo '<h2 id="post-types">' . esc_html__( 'Post Types', 'custom-post-type-ui' ) . '</h2>';
39
  if ( ! empty( $post_types ) ) {
40
  ?>
41
+ <p><?php printf( esc_html__( 'CPTUI registered post types count total: %d', 'custom-post-type-ui' ), count( $post_types ) ); ?></p>
42
 
43
  <?php
44
 
58
  */
59
  do_action( 'cptui_before_post_type_listing' );
60
  ?>
61
+ <table class="wp-list-table widefat post-type-listing">
62
  <tr>
63
  <?php
64
  foreach ( $post_type_table_heads as $head ) {
100
  }
101
  ?>
102
  <tr class="<?php echo esc_attr( $rowclass ); ?>">
103
+ <?php
104
+ $edit_path = 'admin.php?page=cptui_manage_post_types&action=edit&cptui_post_type=' . $post_type;
105
+ $post_type_link_url = ( is_network_admin() ) ? network_admin_url( $edit_path ) : admin_url( $edit_path ); ?>
106
+ <td>
107
+ <?php
108
+ printf(
109
+ '<a href="%s">%s</a> | <a href="%s">%s</a><br/>',
110
+ esc_attr( $post_type_link_url ),
111
+ sprintf(
112
+ esc_html__( 'Edit %s', 'custom-post-type-ui' ),
113
+ esc_html( $post_type )
114
+ ),
115
+ esc_attr( admin_url( 'admin.php?page=cptui_importexport&action=get_code#' . $post_type ) ),
116
+ esc_html__( 'Get code', 'custom-post-type-ui' )
117
+ );
118
+
119
+ if ( $archive ) {
120
+ ?>
121
  <a href="<?php echo esc_attr( get_post_type_archive_link( $post_type ) ); ?>"><?php esc_html_e( 'View frontend archive', 'custom-post-type-ui' ); ?></a>
122
  <?php } ?>
123
  </td>
150
  $maybe_empty = array_filter( $post_type_settings['labels'] );
151
  if ( ! empty( $maybe_empty ) ) {
152
  foreach ( $post_type_settings['labels'] as $key => $value ) {
153
+ if ( 'parent' === $key && array_key_exists( 'parent_item_colon', $post_type_settings['labels'] ) ) {
154
+ continue;
155
+ }
156
  printf(
157
  '%s: %s<br/>',
158
  esc_html( $key ),
172
  </p>
173
 
174
  <p><strong><?php esc_html_e( 'Single Posts file name examples.', 'custom-post-type-ui' ); ?></strong><br/>
175
+ single-<?php echo esc_html( $post_type ); ?>-post_slug.php (WP 4.4+) *<br/>
176
  single-<?php echo esc_html( $post_type ); ?>.php<br/>
177
  single.php<br/>
178
+ singular.php (WP 4.3+)<br/>
179
  index.php
180
  </p>
181
 
182
+ <p>
183
+ <?php esc_html_e( '*Replace "post_slug" with the slug of the actual post slug.', 'custom-post-type-ui' ); ?>
184
+ </p>
185
+
186
  <p><?php
187
  printf(
188
  '<a href="https://developer.wordpress.org/themes/basics/template-hierarchy/">%s</a>',
220
  do_action( 'cptui_no_post_types_listing' );
221
  }
222
 
223
+ $taxonomies = cptui_get_taxonomy_data();
224
  echo '<h2 id="taxonomies">' . esc_html__( 'Taxonomies', 'custom-post-type-ui' ) . '</h2>';
225
  if ( ! empty( $taxonomies ) ) {
226
  ?>
227
+ <p><?php printf( esc_html__( 'CPTUI registered taxonomies count total: %d', 'custom-post-type-ui' ), count( $taxonomies ) ); ?></p>
228
 
229
  <?php
230
 
243
  */
244
  do_action( 'cptui_before_taxonomy_listing' );
245
  ?>
246
+ <table class="wp-list-table widefat taxonomy-listing">
247
  <tr>
248
  <?php
249
  foreach ( $taxonomy_table_heads as $head ) {
279
  }
280
  ?>
281
  <tr class="<?php echo esc_attr( $rowclass ); ?>">
282
+ <?php
283
+ $edit_path = 'admin.php?page=cptui_manage_taxonomies&action=edit&cptui_taxonomy=' . $taxonomy;
284
+ $taxonomy_link_url = ( is_network_admin() ) ? network_admin_url( $edit_path ) : admin_url( $edit_path ); ?>
285
+ <td>
286
+ <?php printf(
287
+ '<a href="%s">%s</a> | <a href="%s">%s</a>',
288
+ esc_attr( $taxonomy_link_url ),
289
+ sprintf(
290
+ esc_html__( 'Edit %s', 'custom-post-type-ui' ),
291
+ esc_html( $taxonomy )
292
+ ),
293
+ esc_attr( admin_url( 'admin.php?page=cptui_importexport&action=get_code#' . $taxonomy ) ),
294
+ esc_html__( 'Get code', 'custom-post-type-ui' )
295
+ ); ?>
296
  </td>
297
  <td>
298
  <?php
inc/post-types.php CHANGED
@@ -84,7 +84,7 @@ function cptui_post_type_tabs( $tabs = array(), $current_page = '' ) {
84
  'text' => __( 'Edit Post Types', 'custom-post-type-ui' ),
85
  'classes' => $classes,
86
  'url' => esc_url( add_query_arg( array( 'action' => 'edit' ), cptui_admin_url( 'admin.php?page=cptui_manage_' . $current_page ) ) ),
87
- 'aria-selected' => ( ! empty( $action ) ) ? 'true' : 'false'
88
  );
89
 
90
  $tabs['tabs']['view'] = array(
@@ -93,6 +93,13 @@ function cptui_post_type_tabs( $tabs = array(), $current_page = '' ) {
93
  'url' => esc_url( cptui_admin_url( 'admin.php?page=cptui_listings#post-types' ) ),
94
  'aria-selected' => 'false',
95
  );
 
 
 
 
 
 
 
96
  }
97
  }
98
 
@@ -109,19 +116,6 @@ add_filter( 'cptui_get_tabs', 'cptui_post_type_tabs', 10, 2 );
109
  */
110
  function cptui_manage_post_types() {
111
 
112
- $post_type_deleted = false;
113
-
114
- if ( ! empty( $_POST ) ) {
115
- if ( isset( $_POST['cpt_submit'] ) ) {
116
- check_admin_referer( 'cptui_addedit_post_type_nonce_action', 'cptui_addedit_post_type_nonce_field' );
117
- $notice = cptui_update_post_type( $_POST );
118
- } elseif ( isset( $_POST['cpt_delete'] ) ) {
119
- check_admin_referer( 'cptui_addedit_post_type_nonce_action', 'cptui_addedit_post_type_nonce_field' );
120
- $notice = cptui_delete_post_type( $_POST );
121
- $post_type_deleted = true;
122
- }
123
- }
124
-
125
  $tab = ( ! empty( $_GET ) && ! empty( $_GET['action'] ) && 'edit' === $_GET['action'] ) ? 'edit' : 'new';
126
  $tab_class = 'cptui-' . $tab; ?>
127
 
@@ -135,9 +129,14 @@ function cptui_manage_post_types() {
135
  */
136
  do_action( 'cptui_inside_post_type_wrap' );
137
 
138
- if ( isset( $notice ) ) {
139
- echo $notice;
140
- }
 
 
 
 
 
141
 
142
  cptui_settings_tab_menu();
143
 
@@ -193,80 +192,895 @@ function cptui_manage_post_types() {
193
  } ?>
194
 
195
  <form class="posttypesui" method="post" action="<?php echo esc_url( cptui_get_post_form_action( $ui ) ); ?>">
196
- <div class="cptui-section">
197
- <?php echo $ui->get_fieldset_start();
198
- echo $ui->get_legend_start();
199
- esc_html_e( 'Basic settings', 'custom-post-type-ui' );
200
- echo $ui->get_legend_end();
201
- ?>
202
- <table class="form-table cptui-table">
203
- <?php
204
- echo $ui->get_tr_start() . $ui->get_th_start();
205
- echo $ui->get_label( 'name', __( 'Post Type Slug', 'custom-post-type-ui' ) );
206
- echo $ui->get_required_span();
207
- echo $ui->get_th_end() . $ui->get_td_start();
208
-
209
- echo $ui->get_text_input( array(
210
- 'namearray' => 'cpt_custom_post_type',
211
- 'name' => 'name',
212
- 'textvalue' => ( isset( $current['name'] ) ) ? esc_attr( $current['name'] ) : '',
213
- 'maxlength' => '20',
214
- 'helptext' => esc_html__( 'The post type name/slug. Used for various queries for post type content.', 'custom-post-type-ui' ),
215
- 'required' => true,
216
- 'placeholder' => false,
217
- 'wrap' => false,
218
- ) );
219
- echo '<p class="cptui-slug-details">';
220
- esc_html_e( 'Slugs should only contain alphanumeric, latin characters. Underscores or dashes should be used in place of spaces.', 'custom-post-type-ui' );
221
- echo '</p>';
222
-
223
- if ( 'edit' == $tab ) {
224
- echo '<p>';
225
- esc_html_e( 'DO NOT EDIT the post type slug unless also planning to migrate posts. Changing the slug registers a new post type entry.', 'custom-post-type-ui' );
 
 
 
 
 
 
226
  echo '</p>';
227
 
228
- echo '<div class="cptui-spacer">';
229
- echo $ui->get_check_input( array(
230
- 'checkvalue' => 'update_post_types',
231
- 'checked' => 'false',
232
- 'name' => 'update_post_types',
233
- 'namearray' => 'update_post_types',
234
- 'labeltext' => esc_html__( 'Migrate posts to newly renamed post type?', 'custom-post-type-ui' ),
235
- 'helptext' => false,
236
- 'default' => false,
237
- 'wrap' => false,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
238
  ) );
239
- echo '</div>';
240
- }
241
-
242
- echo $ui->get_td_end(); echo $ui->get_tr_end();
243
-
244
- echo $ui->get_text_input( array(
245
- 'namearray' => 'cpt_custom_post_type',
246
- 'name' => 'label',
247
- 'textvalue' => ( isset( $current['label'] ) ) ? esc_attr( $current['label'] ) : '',
248
- 'labeltext' => esc_html__( 'Plural Label', 'custom-post-type-ui' ),
249
- 'aftertext' => esc_html__( '(e.g. Movies)', 'custom-post-type-ui' ),
250
- 'helptext' => esc_html__( 'Used for the post type admin menu item.', 'custom-post-type-ui' ),
251
- 'required' => true,
252
- ) );
253
-
254
- echo $ui->get_text_input( array(
255
- 'namearray' => 'cpt_custom_post_type',
256
- 'name' => 'singular_label',
257
- 'textvalue' => ( isset( $current['singular_label'] ) ) ? esc_attr( $current['singular_label'] ) : '',
258
- 'labeltext' => esc_html__( 'Singular Label', 'custom-post-type-ui' ),
259
- 'aftertext' => esc_html__( '(e.g. Movie)', 'custom-post-type-ui' ),
260
- 'helptext' => esc_html__( 'Used when a singular label is needed.', 'custom-post-type-ui' ),
261
- 'required' => true,
262
- ) );
263
- ?>
264
- </table>
265
- <p class="submit">
266
- <?php wp_nonce_field( 'cptui_addedit_post_type_nonce_action', 'cptui_addedit_post_type_nonce_field' );
267
- if ( ! empty( $_GET ) && ! empty( $_GET['action'] ) && 'edit' == $_GET['action'] ) { ?>
268
- <?php
269
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
270
  /**
271
  * Filters the text value to use on the button when editing.
272
  *
@@ -287,8 +1101,8 @@ function cptui_manage_post_types() {
287
  */
288
  ?>
289
  <input type="submit" class="button-secondary" name="cpt_delete" id="cpt_submit_delete" value="<?php echo esc_attr( apply_filters( 'cptui_post_type_submit_delete', __( 'Delete Post Type', 'custom-post-type-ui' ) ) ); ?>" />
290
- <?php } else { ?>
291
- <?php
292
 
293
  /**
294
  * Filters the text value to use on the button when adding.
@@ -299,796 +1113,9 @@ function cptui_manage_post_types() {
299
  */
300
  ?>
301
  <input type="submit" class="button-primary" name="cpt_submit" value="<?php echo esc_attr( apply_filters( 'cptui_post_type_submit_add', __( 'Add Post Type', 'custom-post-type-ui' ) ) ); ?>" />
302
- <?php }
303
-
304
- if ( ! empty( $current ) ) { ?>
305
- <input type="hidden" name="cpt_original" id="cpt_original" value="<?php esc_attr_e( $current['name'] ); ?>" />
306
- <?php }
307
-
308
- // Used to check and see if we should prevent duplicate slugs. ?>
309
- <input type="hidden" name="cpt_type_status" id="cpt_type_status" value="<?php esc_attr_e( $tab ); ?>" />
310
- </p>
311
- <?php echo $ui->get_fieldset_end(); ?>
312
- </div>
313
- <div class="cptui-section">
314
- <p>
315
- <a href="#" id="togglelabels" class="button-secondary"><?php esc_html_e( 'Edit additional labels', 'custom-post-type-ui' ); ?></a>
316
- </p>
317
- <?php
318
- $fieldset_classes = ( 'edit' == $tab ) ? '' : 'toggledclosed';
319
- echo $ui->get_fieldset_start( array( 'id' => 'labels_expand', 'classes' => array( $fieldset_classes ), ) );
320
- echo $ui->get_legend_start();
321
- esc_html_e( 'Additional labels', 'custom-post-type-ui' );
322
- echo $ui->get_legend_end();
323
- ?>
324
- <table class="form-table cptui-table">
325
- <?php
326
-
327
- if ( isset( $current['description'] ) ) {
328
- $current['description'] = stripslashes_deep( $current['description'] );
329
- }
330
- echo $ui->get_textarea_input( array(
331
- 'namearray' => 'cpt_custom_post_type',
332
- 'name' => 'description',
333
- 'rows' => '4',
334
- 'cols' => '40',
335
- 'textvalue' => ( isset( $current['description'] ) ) ? esc_textarea( $current['description'] ) : '',
336
- 'labeltext' => __( 'Post Type Description', 'custom-post-type-ui' ),
337
- 'helptext' => esc_attr__( 'Perhaps describe what your custom post type is used for?', 'custom-post-type-ui' ),
338
- ) );
339
-
340
- echo $ui->get_text_input( array(
341
- 'labeltext' => __( 'Menu Name', 'custom-post-type-ui' ),
342
- 'helptext' => esc_attr__( 'Custom admin menu name for your custom post type.', 'custom-post-type-ui' ),
343
- 'namearray' => 'cpt_labels',
344
- 'name' => 'menu_name',
345
- 'textvalue' => ( isset( $current['labels']['menu_name'] ) ) ? esc_attr( $current['labels']['menu_name'] ) : '',
346
- 'aftertext' => __( '(e.g. My Movies)', 'custom-post-type-ui' ),
347
- ) );
348
-
349
- echo $ui->get_text_input( array(
350
- 'labeltext' => __( 'All Items', 'custom-post-type-ui' ),
351
- 'helptext' => esc_attr__( 'Used in the post type admin submenu.', 'custom-post-type-ui' ),
352
- 'namearray' => 'cpt_labels',
353
- 'name' => 'all_items',
354
- 'textvalue' => ( isset( $current['labels']['all_items'] ) ) ? esc_attr( $current['labels']['all_items'] ) : '',
355
- 'aftertext' => __( '(e.g. All Movies)', 'custom-post-type-ui' ),
356
- ) );
357
-
358
- echo $ui->get_text_input( array(
359
- 'labeltext' => __( 'Add New', 'custom-post-type-ui' ),
360
- 'helptext' => esc_attr__( 'Used in the post type admin submenu.', 'custom-post-type-ui' ),
361
- 'namearray' => 'cpt_labels',
362
- 'name' => 'add_new',
363
- 'textvalue' => ( isset( $current['labels']['add_new'] ) ) ? esc_attr( $current['labels']['add_new'] ) : '',
364
- 'aftertext' => __( '(e.g. Add New)', 'custom-post-type-ui' ),
365
- ) );
366
-
367
- echo $ui->get_text_input( array(
368
- 'labeltext' => __( 'Add New Item', 'custom-post-type-ui' ),
369
- 'helptext' => esc_attr__( 'Used at the top of the post editor screen for a new post type post.', 'custom-post-type-ui' ),
370
- 'namearray' => 'cpt_labels',
371
- 'name' => 'add_new_item',
372
- 'textvalue' => ( isset( $current['labels']['add_new_item'] ) ) ? esc_attr( $current['labels']['add_new_item'] ) : '',
373
- 'aftertext' => __( '(e.g. Add New Movie)', 'custom-post-type-ui' ),
374
- ) );
375
-
376
- echo $ui->get_text_input( array(
377
- 'labeltext' => __( 'Edit Item', 'custom-post-type-ui' ),
378
- 'helptext' => esc_attr__( 'Used at the top of the post editor screen for an existing post type post.', 'custom-post-type-ui' ),
379
- 'namearray' => 'cpt_labels',
380
- 'name' => 'edit_item',
381
- 'textvalue' => ( isset( $current['labels']['edit_item'] ) ) ? esc_attr( $current['labels']['edit_item'] ) : '',
382
- 'aftertext' => __( '(e.g. Edit Movie)', 'custom-post-type-ui' ),
383
- ) );
384
-
385
- echo $ui->get_text_input( array(
386
- 'labeltext' => __( 'New Item', 'custom-post-type-ui' ),
387
- 'helptext' => esc_attr__( 'Post type label. Used in the admin menu for displaying post types.', 'custom-post-type-ui' ),
388
- 'namearray' => 'cpt_labels',
389
- 'name' => 'new_item',
390
- 'textvalue' => ( isset( $current['labels']['new_item'] ) ) ? esc_attr( $current['labels']['new_item'] ) : '',
391
- 'aftertext' => __( '(e.g. New Movie)', 'custom-post-type-ui' ),
392
- ) );
393
-
394
- echo $ui->get_text_input( array(
395
- 'labeltext' => __( 'View Item', 'custom-post-type-ui' ),
396
- 'helptext' => esc_attr__( 'Used in the admin bar when viewing editor screen for a published post in the post type.', 'custom-post-type-ui' ),
397
- 'namearray' => 'cpt_labels',
398
- 'name' => 'view_item',
399
- 'textvalue' => ( isset( $current['labels']['view_item'] ) ) ? esc_attr( $current['labels']['view_item'] ) : '',
400
- 'aftertext' => __( '(e.g. View Movie)', 'custom-post-type-ui' ),
401
- ) );
402
-
403
- echo $ui->get_text_input( array(
404
- 'labeltext' => __( 'Search Item', 'custom-post-type-ui' ),
405
- 'helptext' => esc_attr__( 'Used as the text for the search button on post type list screen.', 'custom-post-type-ui' ),
406
- 'namearray' => 'cpt_labels',
407
- 'name' => 'search_items',
408
- 'textvalue' => ( isset( $current['labels']['search_items'] ) ) ? esc_attr( $current['labels']['search_items'] ) : '',
409
- 'aftertext' => __( '(e.g. Search Movie)', 'custom-post-type-ui' ),
410
- ) );
411
-
412
- echo $ui->get_text_input( array(
413
- 'labeltext' => __( 'Not Found', 'custom-post-type-ui' ),
414
- 'helptext' => esc_attr__( 'Used when there are no posts to display on the post type list screen.', 'custom-post-type-ui' ),
415
- 'namearray' => 'cpt_labels',
416
- 'name' => 'not_found',
417
- 'textvalue' => ( isset( $current['labels']['not_found'] ) ) ? esc_attr( $current['labels']['not_found'] ) : '',
418
- 'aftertext' => __( '(e.g. No Movies found)', 'custom-post-type-ui' ),
419
- ) );
420
-
421
- echo $ui->get_text_input( array(
422
- 'labeltext' => __( 'Not Found in Trash', 'custom-post-type-ui' ),
423
- 'helptext' => esc_attr__( 'Used when there are no posts to display on the post type list trash screen.', 'custom-post-type-ui' ),
424
- 'namearray' => 'cpt_labels',
425
- 'name' => 'not_found_in_trash',
426
- 'textvalue' => ( isset( $current['labels']['not_found_in_trash'] ) ) ? esc_attr( $current['labels']['not_found_in_trash'] ) : '',
427
- 'aftertext' => __( '(e.g. No Movies found in Trash)', 'custom-post-type-ui' ),
428
- ) );
429
-
430
- echo $ui->get_text_input( array(
431
- 'labeltext' => __( 'Parent', 'custom-post-type-ui' ),
432
- 'helptext' => esc_attr__( 'Post type label. Used in the admin menu for displaying post types.', 'custom-post-type-ui' ),
433
- 'namearray' => 'cpt_labels',
434
- 'name' => 'parent',
435
- 'textvalue' => ( isset( $current['labels']['parent'] ) ) ? esc_attr( $current['labels']['parent'] ) : '',
436
- 'aftertext' => __( '(e.g. Parent Movie)', 'custom-post-type-ui' ),
437
- ) );
438
-
439
- echo $ui->get_text_input( array(
440
- 'labeltext' => __( 'Featured Image', 'custom-post-type-ui' ),
441
- 'helptext' => esc_attr__( 'Used as the "Featured Image" phrase for the post type.', 'custom-post-type-ui' ),
442
- 'namearray' => 'cpt_labels',
443
- 'name' => 'featured_image',
444
- 'textvalue' => ( isset( $current['labels']['featured_image'] ) ) ? esc_attr( $current['labels']['featured_image'] ) : '',
445
- 'aftertext' => __( '(e.g. Featured image for this movie)', 'custom-post-type-ui' ),
446
- ) );
447
-
448
- echo $ui->get_text_input( array(
449
- 'labeltext' => __( 'Set Featured Image', 'custom-post-type-ui' ),
450
- 'helptext' => esc_attr__( 'Used as the "Set featured image" phrase for the post type.', 'custom-post-type-ui' ),
451
- 'namearray' => 'cpt_labels',
452
- 'name' => 'set_featured_image',
453
- 'textvalue' => ( isset( $current['labels']['set_featured_image'] ) ) ? esc_attr( $current['labels']['set_featured_image'] ) : '',
454
- 'aftertext' => __( '(e.g. Set featured image for this movie)', 'custom-post-type-ui' ),
455
- ) );
456
-
457
- echo $ui->get_text_input( array(
458
- 'labeltext' => __( 'Remove Featured Image', 'custom-post-type-ui' ),
459
- 'helptext' => esc_attr__( 'Used as the "Remove featured image" phrase for the post type.', 'custom-post-type-ui' ),
460
- 'namearray' => 'cpt_labels',
461
- 'name' => 'remove_featured_image',
462
- 'textvalue' => ( isset( $current['labels']['remove_featured_image'] ) ) ? esc_attr( $current['labels']['remove_featured_image'] ) : '',
463
- 'aftertext' => __( '(e.g. Remove featured image for this movie)', 'custom-post-type-ui' ),
464
- ) );
465
-
466
- echo $ui->get_text_input( array(
467
- 'labeltext' => __( 'Use Featured Image', 'custom-post-type-ui' ),
468
- 'helptext' => esc_attr__( 'Used as the "Use as featured image" phrase for the post type.', 'custom-post-type-ui' ),
469
- 'namearray' => 'cpt_labels',
470
- 'name' => 'use_featured_image',
471
- 'textvalue' => ( isset( $current['labels']['use_featured_image'] ) ) ? esc_attr( $current['labels']['use_featured_image'] ) : '',
472
- 'aftertext' => __( '(e.g. Use as featured image for this movie)', 'custom-post-type-ui' ),
473
- ) );
474
-
475
- echo $ui->get_text_input( array(
476
- 'labeltext' => __( 'Archives', 'custom-post-type-ui' ),
477
- 'helptext' => esc_attr__( 'Post type archive label used in nav menus.', 'custom-post-type-ui' ),
478
- 'namearray' => 'cpt_labels',
479
- 'name' => 'archives',
480
- 'textvalue' => ( isset( $current['labels']['archives'] ) ) ? esc_attr( $current['labels']['archives'] ) : '',
481
- 'aftertext' => __( '(e.g. Movie archives)', 'custom-post-type-ui' ),
482
- ) );
483
-
484
- echo $ui->get_text_input( array(
485
- 'labeltext' => __( 'Insert into item', 'custom-post-type-ui' ),
486
- 'helptext' => esc_attr__( 'Used as the "Insert into post" or "Insert into page" phrase for the post type.', 'custom-post-type-ui' ),
487
- 'namearray' => 'cpt_labels',
488
- 'name' => 'insert_into_item',
489
- 'textvalue' => ( isset( $current['labels']['insert_into_item'] ) ) ? esc_attr( $current['labels']['insert_into_item'] ) : '',
490
- 'aftertext' => __( '(e.g. Insert into movie)', 'custom-post-type-ui' ),
491
- ) );
492
-
493
- echo $ui->get_text_input( array(
494
- 'labeltext' => __( 'Uploaded to this Item', 'custom-post-type-ui' ),
495
- 'helptext' => esc_attr__( 'Used as the "Uploaded to this post" or "Uploaded to this page" phrase for the post type.', 'custom-post-type-ui' ),
496
- 'namearray' => 'cpt_labels',
497
- 'name' => 'uploaded_to_this_item',
498
- 'textvalue' => ( isset( $current['labels']['uploaded_to_this_item'] ) ) ? esc_attr( $current['labels']['uploaded_to_this_item'] ) : '',
499
- 'aftertext' => __( '(e.g. Uploaded to this movie)', 'custom-post-type-ui' ),
500
- ) );
501
-
502
- echo $ui->get_text_input( array(
503
- 'labeltext' => __( 'Filter Items List', 'custom-post-type-ui' ),
504
- 'helptext' => esc_attr__( 'Screen reader text for the filter links heading on the post type listing screen.', 'custom-post-type-ui' ),
505
- 'namearray' => 'cpt_labels',
506
- 'name' => 'filter_items_list',
507
- 'textvalue' => ( isset( $current['labels']['filter_items_list'] ) ) ? esc_attr( $current['labels']['filter_items_list'] ) : '',
508
- 'aftertext' => __( '(e.g. Filter movies list)', 'custom-post-type-ui' ),
509
- ) );
510
-
511
- echo $ui->get_text_input( array(
512
- 'labeltext' => __( 'Items List Navigation', 'custom-post-type-ui' ),
513
- 'helptext' => esc_attr__( 'Screen reader text for the pagination heading on the post type listing screen.', 'custom-post-type-ui' ),
514
- 'namearray' => 'cpt_labels',
515
- 'name' => 'items_list_navigation',
516
- 'textvalue' => ( isset( $current['labels']['items_list_navigation'] ) ) ? esc_attr( $current['labels']['items_list_navigation'] ) : '',
517
- 'aftertext' => __( '(e.g. Movies list navigation)', 'custom-post-type-ui' ),
518
- ) );
519
-
520
- echo $ui->get_text_input( array(
521
- 'labeltext' => __( 'Items List', 'custom-post-type-ui' ),
522
- 'helptext' => esc_attr__( 'Screen reader text for the items list heading on the post type listing screen.', 'custom-post-type-ui' ),
523
- 'namearray' => 'cpt_labels',
524
- 'name' => 'items_list',
525
- 'textvalue' => ( isset( $current['labels']['items_list'] ) ) ? esc_attr( $current['labels']['items_list'] ) : '',
526
- 'aftertext' => __( '(e.g. Movies list)', 'custom-post-type-ui' ),
527
- ) );
528
- ?>
529
- </table>
530
- <?php echo $ui->get_fieldset_end(); ?>
531
- </div>
532
- <div class="cptui-section">
533
- <p>
534
- <a href="#" id="togglesettings" class="button-secondary"><?php esc_html_e( 'Edit settings', 'custom-post-type-ui' ); ?></a>
535
  </p>
536
- <?php
537
- $fieldset_classes = '';
538
- echo $ui->get_fieldset_start( array( 'id' => 'settings_expand', 'classes' => array( $fieldset_classes ), ) );
539
- echo $ui->get_legend_start();
540
- esc_html_e( 'Settings', 'custom-post-type-ui' );
541
- echo $ui->get_legend_end();
542
- ?>
543
- <table class="form-table cptui-table">
544
- <?php
545
- $select = array(
546
- 'options' => array(
547
- array( 'attr' => '0', 'text' => __( 'False', 'custom-post-type-ui' ) ),
548
- array( 'attr' => '1', 'text' => __( 'True', 'custom-post-type-ui' ), 'default' => 'true' ),
549
- )
550
- );
551
- $selected = ( isset( $current ) ) ? disp_boolean( $current['public'] ) : '';
552
- $select['selected'] = ( !empty( $selected ) ) ? $current['public'] : '';
553
- echo $ui->get_select_input( array(
554
- 'namearray' => 'cpt_custom_post_type',
555
- 'name' => 'public',
556
- 'labeltext' => __( 'Public', 'custom-post-type-ui' ),
557
- 'aftertext' => __( '(CPTUI default: true)', 'custom-post-type-ui' ),
558
- 'helptext' => esc_attr__( 'WordPress core defaults to false. CPTUI defaults to true for user sake. Whether posts of this type should be shown in the admin UI and is publicly queryable.', 'custom-post-type-ui' ),
559
- 'selections' => $select,
560
- ) );
561
-
562
- $select = array(
563
- 'options' => array(
564
- array( 'attr' => '0', 'text' => __( 'False', 'custom-post-type-ui' ) ),
565
- array( 'attr' => '1', 'text' => __( 'True', 'custom-post-type-ui' ), 'default' => 'true' )
566
- )
567
- );
568
- $selected = ( isset( $current ) ) ? disp_boolean( $current['show_ui'] ) : '';
569
- $select['selected'] = ( !empty( $selected ) ) ? $current['show_ui'] : '';
570
- echo $ui->get_select_input( array(
571
- 'namearray' => 'cpt_custom_post_type',
572
- 'name' => 'show_ui',
573
- 'labeltext' => __( 'Show UI', 'custom-post-type-ui' ),
574
- 'aftertext' => __( '(default: true)', 'custom-post-type-ui' ),
575
- 'helptext' => esc_attr__( 'Whether to generate a default UI for managing this post type.', 'custom-post-type-ui' ),
576
- 'selections' => $select
577
- ) );
578
-
579
- $select = array(
580
- 'options' => array(
581
- array( 'attr' => '0', 'text' => __( 'False', 'custom-post-type-ui' ) ),
582
- array( 'attr' => '1', 'text' => __( 'True', 'custom-post-type-ui' ), 'default' => 'true' ),
583
- )
584
- );
585
- $selected = ( isset( $current ) && ! empty( $current['show_in_nav_menus'] ) ) ? disp_boolean( $current['show_in_nav_menus'] ) : '';
586
- $select['selected'] = ( ! empty( $selected ) && ! empty( $current['show_in_nav_menus'] ) ) ? $current['show_in_nav_menus'] : '';
587
- echo $ui->get_select_input( array(
588
- 'namearray' => 'cpt_custom_post_type',
589
- 'name' => 'show_in_nav_menus',
590
- 'labeltext' => __( 'Show in Nav Menus', 'custom-post-type-ui' ),
591
- 'aftertext' => __( '(CPTUI default: true)', 'custom-post-type-ui' ),
592
- 'helptext' => esc_attr__( 'Whether post type is available for selection in navigation menus.', 'custom-post-type-ui' ),
593
- 'selections' => $select,
594
- ) );
595
-
596
- $select = array(
597
- 'options' => array(
598
- array( 'attr' => '0', 'text' => __( 'False', 'custom-post-type-ui' ), 'default' => 'false' ),
599
- array( 'attr' => '1', 'text' => __( 'True', 'custom-post-type-ui' ) ),
600
- )
601
- );
602
- $selected = ( isset( $current ) && ! empty( $current['show_in_rest'] ) ) ? disp_boolean( $current['show_in_rest'] ) : '';
603
- $select['selected'] = ( !empty( $selected ) && ! empty( $current['show_in_rest'] ) ) ? $current['show_in_rest'] : '';
604
- echo $ui->get_select_input( array(
605
- 'namearray' => 'cpt_custom_post_type',
606
- 'name' => 'show_in_rest',
607
- 'labeltext' => __( 'Show in REST API', 'custom-post-type-ui' ),
608
- 'aftertext' => __( '(default: false)', 'custom-post-type-ui' ),
609
- 'helptext' => esc_attr__( 'Whether to show this post type data in the WP REST API.', 'custom-post-type-ui' ),
610
- 'selections' => $select
611
- ) );
612
-
613
- echo $ui->get_text_input( array(
614
- 'labeltext' => __( 'REST API base slug', 'custom-post-type-ui' ),
615
- 'helptext' => esc_attr__( 'Slug to use in REST API URLs.', 'custom-post-type-ui' ),
616
- 'namearray' => 'cpt_custom_post_type',
617
- 'name' => 'rest_base',
618
- 'textvalue' => ( isset( $current['rest_base'] ) ) ? esc_attr( $current['rest_base'] ) : '',
619
- ) );
620
-
621
- echo $ui->get_tr_start() . $ui->get_th_start();
622
- echo $ui->get_label( 'has_archive', __( 'Has Archive', 'custom-post-type-ui' ) );
623
- echo $ui->get_help( esc_attr__( 'Whether the post type will have a post type archive URL.', 'custom-post-type-ui' ) );
624
- echo $ui->get_p( __( 'If left blank, the archive slug will default to the post type slug.', 'custom-post-type-ui' ) );
625
- echo $ui->get_th_end() . $ui->get_td_start();
626
-
627
- $select = array(
628
- 'options' => array(
629
- array( 'attr' => '0', 'text' => __( 'False', 'custom-post-type-ui' ), 'default' => 'true' ),
630
- array( 'attr' => '1', 'text' => __( 'True', 'custom-post-type-ui' ) ),
631
- )
632
- );
633
- $selected = ( isset( $current ) ) ? disp_boolean( $current['has_archive'] ) : '';
634
- $select['selected'] = ( !empty( $selected ) ) ? $current['has_archive'] : '';
635
- echo $ui->get_select_input( array(
636
- 'namearray' => 'cpt_custom_post_type',
637
- 'name' => 'has_archive',
638
- 'aftertext' => __( '(default: false)', 'custom-post-type-ui' ),
639
- 'selections' => $select,
640
- 'wrap' => false,
641
- ) );
642
-
643
- echo '<br/>';
644
-
645
- echo $ui->get_text_input( array(
646
- 'namearray' => 'cpt_custom_post_type',
647
- 'name' => 'has_archive_string',
648
- 'textvalue' => ( isset( $current['has_archive_string'] ) ) ? esc_attr( $current['has_archive_string'] ) : '',
649
- 'helptext' => esc_attr__( 'Slug to be used for archive URL.', 'custom-post-type-ui' ),
650
- 'helptext_after'=> true,
651
- 'wrap' => false,
652
- ) );
653
- echo $ui->get_td_end() . $ui->get_tr_end();
654
-
655
- $select = array(
656
- 'options' => array(
657
- array( 'attr' => '0', 'text' => __( 'False', 'custom-post-type-ui' ), 'default' => 'true' ),
658
- array( 'attr' => '1', 'text' => __( 'True', 'custom-post-type-ui' ) ),
659
- )
660
- );
661
- $selected = ( isset( $current ) ) ? disp_boolean( $current['exclude_from_search'] ) : '';
662
- $select['selected'] = ( !empty( $selected ) ) ? $current['exclude_from_search'] : '';
663
- echo $ui->get_select_input( array(
664
- 'namearray' => 'cpt_custom_post_type',
665
- 'name' => 'exclude_from_search',
666
- 'labeltext' => __( 'Exclude From Search', 'custom-post-type-ui' ),
667
- 'aftertext' => __( '(default: false)', 'custom-post-type-ui' ),
668
- 'helptext' => esc_attr__( 'Whether to exclude posts with this post type from front end search results.', 'custom-post-type-ui' ),
669
- 'selections' => $select,
670
- ) );
671
-
672
- echo $ui->get_text_input( array(
673
- 'namearray' => 'cpt_custom_post_type',
674
- 'name' => 'capability_type',
675
- 'textvalue' => ( isset( $current['capability_type'] ) ) ? esc_attr( $current['capability_type'] ) : 'post',
676
- 'labeltext' => __( 'Capability Type', 'custom-post-type-ui' ),
677
- 'helptext' => esc_attr__( 'The post type to use for checking read, edit, and delete capabilities', 'custom-post-type-ui' ),
678
- ) );
679
-
680
- $select = array(
681
- 'options' => array(
682
- array( 'attr' => '0', 'text' => __( 'False', 'custom-post-type-ui' ), 'default' => 'true' ),
683
- array( 'attr' => '1', 'text' => __( 'True', 'custom-post-type-ui' ) ),
684
- )
685
- );
686
- $selected = ( isset( $current ) ) ? disp_boolean( $current['hierarchical'] ) : '';
687
- $select['selected'] = ( !empty( $selected ) ) ? $current['hierarchical'] : '';
688
- echo $ui->get_select_input( array(
689
- 'namearray' => 'cpt_custom_post_type',
690
- 'name' => 'hierarchical',
691
- 'labeltext' => __( 'Hierarchical', 'custom-post-type-ui' ),
692
- 'aftertext' => __( '(default: false)', 'custom-post-type-ui' ),
693
- 'helptext' => esc_attr__( 'Whether the post type can have parent-child relationships', 'custom-post-type-ui' ),
694
- 'selections' => $select,
695
- ) );
696
-
697
- $select = array(
698
- 'options' => array(
699
- array( 'attr' => '0', 'text' => __( 'False', 'custom-post-type-ui' ) ),
700
- array( 'attr' => '1', 'text' => __( 'True', 'custom-post-type-ui' ), 'default' => 'true' ),
701
- )
702
- );
703
- $selected = ( isset( $current ) ) ? disp_boolean( $current['rewrite'] ) : '';
704
- $select['selected'] = ( !empty( $selected ) ) ? $current['rewrite'] : '';
705
- echo $ui->get_select_input( array(
706
- 'namearray' => 'cpt_custom_post_type',
707
- 'name' => 'rewrite',
708
- 'labeltext' => __( 'Rewrite', 'custom-post-type-ui' ),
709
- 'aftertext' => __( '(default: true)', 'custom-post-type-ui' ),
710
- 'helptext' => esc_attr__( 'Whether or not WordPress should use rewrites for this post type', 'custom-post-type-ui' ),
711
- 'selections' => $select,
712
- ) );
713
-
714
- echo $ui->get_text_input( array(
715
- 'namearray' => 'cpt_custom_post_type',
716
- 'name' => 'rewrite_slug',
717
- 'textvalue' => ( isset( $current['rewrite_slug'] ) ) ? esc_attr( $current['rewrite_slug'] ) : '',
718
- 'labeltext' => __( 'Custom Rewrite Slug', 'custom-post-type-ui' ),
719
- 'aftertext' => __( '(default: post type slug)', 'custom-post-type-ui' ),
720
- 'helptext' => esc_attr__( 'Custom post type slug to use instead of the default.', 'custom-post-type-ui' ),
721
- ) );
722
-
723
- $select = array(
724
- 'options' => array(
725
- array( 'attr' => '0', 'text' => __( 'False', 'custom-post-type-ui' ) ),
726
- array( 'attr' => '1', 'text' => __( 'True', 'custom-post-type-ui' ), 'default' => 'true' ),
727
- )
728
- );
729
- $selected = ( isset( $current ) ) ? disp_boolean( $current['rewrite_withfront'] ) : '';
730
- $select['selected'] = ( !empty( $selected ) ) ? $current['rewrite_withfront'] : '';
731
- echo $ui->get_select_input( array(
732
- 'namearray' => 'cpt_custom_post_type',
733
- 'name' => 'rewrite_withfront',
734
- 'labeltext' => __( 'With Front', 'custom-post-type-ui' ),
735
- 'aftertext' => __( '(default: true)', 'custom-post-type-ui' ),
736
- 'helptext' => esc_attr__( 'Should the permastruct be prepended with the front base.', 'custom-post-type-ui' ),
737
- 'selections' => $select,
738
- ) );
739
-
740
- $select = array(
741
- 'options' => array(
742
- array( 'attr' => '0', 'text' => __( 'False', 'custom-post-type-ui' ) ),
743
- array( 'attr' => '1', 'text' => __( 'True', 'custom-post-type-ui' ), 'default' => 'true' ),
744
- )
745
- );
746
- $selected = ( isset( $current ) ) ? disp_boolean( $current['query_var'] ) : '';
747
- $select['selected'] = ( !empty( $selected ) ) ? $current['query_var'] : '';
748
- echo $ui->get_select_input( array(
749
- 'namearray' => 'cpt_custom_post_type',
750
- 'name' => 'query_var',
751
- 'labeltext' => __( 'Query Var', 'custom-post-type-ui' ),
752
- 'aftertext' => __( '(default: true)', 'custom-post-type-ui' ),
753
- 'helptext' => esc_attr__( 'Sets the query_var key for this post type.', 'custom-post-type-ui' ),
754
- 'selections' => $select,
755
- ) );
756
-
757
- echo $ui->get_text_input( array(
758
- 'namearray' => 'cpt_custom_post_type',
759
- 'name' => 'query_var_slug',
760
- 'textvalue' => ( isset( $current['query_var_slug'] ) ) ? esc_attr( $current['query_var_slug'] ) : '',
761
- 'labeltext' => __( 'Custom Query Var Slug', 'custom-post-type-ui' ),
762
- 'aftertext' => __( '(default: post type slug) Query var needs to be true to use.', 'custom-post-type-ui' ),
763
- 'helptext' => esc_attr__( 'Custom query var slug to use instead of the default.', 'custom-post-type-ui' ),
764
- ) );
765
-
766
- echo $ui->get_tr_start() . $ui->get_th_start();
767
- echo $ui->get_label( 'menu_position', __( 'Menu Position', 'custom-post-type-ui' ) );
768
- echo $ui->get_help( esc_attr__( 'The position in the menu order the post type should appear. show_in_menu must be true.', 'custom-post-type-ui' ) );
769
- echo $ui->get_p( __( 'See <a href="http://codex.wordpress.org/Function_Reference/register_post_type#Parameters" target="_blank">Available options</a> in the "menu_position" section. Range of 5-100', 'custom-post-type-ui' ) );
770
-
771
- echo $ui->get_th_end() . $ui->get_td_start();
772
- echo $ui->get_text_input( array(
773
- 'namearray' => 'cpt_custom_post_type',
774
- 'name' => 'menu_position',
775
- 'textvalue' => ( isset( $current['menu_position'] ) ) ? esc_attr( $current['menu_position'] ) : '',
776
- 'wrap' => false,
777
- ) );
778
- echo $ui->get_td_end() . $ui->get_tr_end();
779
-
780
- echo $ui->get_tr_start() . $ui->get_th_start();
781
- echo $ui->get_label( 'show_in_menu', __( 'Show in Menu', 'custom-post-type-ui' ) );
782
- echo $ui->get_help( esc_attr__( 'Whether to show the post type in the admin menu and where to show that menu.', 'custom-post-type-ui' ) );
783
- echo $ui->get_p( __( '"Show UI" must be "true". If an existing top level page such as "tools.php" is indicated for second input, post type will be sub menu of that.', 'custom-post-type-ui' ) );
784
- echo $ui->get_th_end() . $ui->get_td_start();
785
-
786
- $select = array(
787
- 'options' => array(
788
- array( 'attr' => '0', 'text' => __( 'False', 'custom-post-type-ui' ) ),
789
- array( 'attr' => '1', 'text' => __( 'True', 'custom-post-type-ui' ), 'default' => 'true' ),
790
- )
791
- );
792
- $selected = ( isset( $current ) ) ? disp_boolean( $current['show_in_menu'] ) : '';
793
- $select['selected'] = ( !empty( $selected ) ) ? $current['show_in_menu'] : '';
794
- echo $ui->get_select_input( array(
795
- 'namearray' => 'cpt_custom_post_type',
796
- 'name' => 'show_in_menu',
797
- 'aftertext' => __( '(default: true)', 'custom-post-type-ui' ),
798
- 'selections' => $select,
799
- 'wrap' => false,
800
- ) );
801
-
802
- echo '<br/>';
803
-
804
- echo $ui->get_text_input( array(
805
- 'namearray' => 'cpt_custom_post_type',
806
- 'name' => 'show_in_menu_string',
807
- 'textvalue' => ( isset( $current['show_in_menu_string'] ) ) ? esc_attr( $current['show_in_menu_string'] ) : '',
808
- 'helptext' => esc_attr__( 'Top-level page file name to make post type a sub-menu of.', 'custom-post-type-ui' ),
809
- 'helptext_after'=> true,
810
- 'wrap' => false,
811
- ) );
812
- echo $ui->get_td_end() . $ui->get_tr_end();
813
-
814
- echo $ui->get_tr_start() . $ui->get_th_start() . '<label for="menu_icon">' . __( 'Menu Icon', 'custom-post-type-ui' ) . '</label>' . $ui->get_th_end() . $ui->get_td_start();
815
- echo $ui->get_text_input( array(
816
- 'namearray' => 'cpt_custom_post_type',
817
- 'name' => 'menu_icon',
818
- 'textvalue' => ( isset( $current['menu_icon'] ) ) ? esc_attr( $current['menu_icon'] ) : '',
819
- 'aftertext' => __( '(Full URL for icon or Dashicon class)', 'custom-post-type-ui' ),
820
- 'helptext' => esc_attr__( 'Image URL or Dashicon class name to use for icon. Custom image should be 20px by 20px.', 'custom-post-type-ui' ),
821
- 'wrap' => false,
822
- ) );
823
-
824
- echo '<div class="cptui-spacer">';
825
-
826
- echo $ui->get_button( array(
827
- 'id' => 'cptui_choose_icon',
828
- 'textvalue' => __( 'Choose image icon', 'custom-post-type-ui' ),
829
- ) );
830
- echo '</div>';
831
-
832
- echo $ui->get_td_end() . $ui->get_tr_end();
833
-
834
- echo $ui->get_tr_start() . $ui->get_th_start() . __( 'Supports', 'custom-post-type-ui' ) . $ui->get_th_end() . $ui->get_td_start() . $ui->get_fieldset_start();
835
-
836
- $title_checked = ( ! empty( $current['supports'] ) && is_array( $current['supports'] ) && in_array( 'title', $current['supports'] ) ) ? 'true' : 'false';
837
- if ( 'new' == $tab ) {
838
- $title_checked = 'true';
839
- }
840
- echo $ui->get_check_input( array(
841
- 'checkvalue' => 'title',
842
- 'checked' => $title_checked,
843
- 'name' => 'title',
844
- 'namearray' => 'cpt_supports',
845
- 'textvalue' => 'title',
846
- 'labeltext' => __( 'Title' , 'custom-post-type-ui' ),
847
- 'helptext' => esc_attr__( 'Adds the title meta box when creating content for this custom post type', 'custom-post-type-ui' ),
848
- 'default' => true,
849
- 'wrap' => false,
850
- ) );
851
-
852
- $editor_checked = ( ! empty( $current['supports'] ) && is_array( $current['supports'] ) && in_array( 'editor', $current['supports'] ) ) ? 'true' : 'false';
853
- if ( 'new' == $tab ) {
854
- $editor_checked = 'true';
855
- }
856
- echo $ui->get_check_input( array(
857
- 'checkvalue' => 'editor',
858
- 'checked' => $editor_checked,
859
- 'name' => 'editor',
860
- 'namearray' => 'cpt_supports',
861
- 'textvalue' => 'editor',
862
- 'labeltext' => __( 'Editor' , 'custom-post-type-ui' ),
863
- 'helptext' => esc_attr__( 'Adds the content editor meta box when creating content for this custom post type', 'custom-post-type-ui' ),
864
- 'default' => true,
865
- 'wrap' => false,
866
- ) );
867
-
868
- $thumb_checked = ( ! empty( $current['supports'] ) && is_array( $current['supports'] ) && in_array( 'thumbnail', $current['supports'] ) ) ? 'true' : 'false';
869
- if ( 'new' == $tab ) {
870
- $thumb_checked = 'true';
871
- }
872
- echo $ui->get_check_input( array(
873
- 'checkvalue' => 'thumbnail',
874
- 'checked' => $thumb_checked,
875
- 'name' => 'thumbnail',
876
- 'namearray' => 'cpt_supports',
877
- 'textvalue' => 'thumbnail',
878
- 'labeltext' => __( 'Featured Image', 'custom-post-type-ui' ),
879
- 'helptext' => esc_attr__( 'Adds the featured image meta box when creating content for this custom post type', 'custom-post-type-ui' ),
880
- 'default' => true,
881
- 'wrap' => false,
882
- ) );
883
-
884
- echo $ui->get_check_input( array(
885
- 'checkvalue' => 'excerpt',
886
- 'checked' => ( !empty( $current['supports'] ) && is_array( $current['supports'] ) && in_array( 'excerpt', $current['supports'] ) ) ? 'true' : 'false',
887
- 'name' => 'excerpts',
888
- 'namearray' => 'cpt_supports',
889
- 'textvalue' => 'excerpt',
890
- 'labeltext' => __( 'Excerpt' , 'custom-post-type-ui' ),
891
- 'helptext' => esc_attr__( 'Adds the excerpt meta box when creating content for this custom post type', 'custom-post-type-ui' ),
892
- 'default' => true,
893
- 'wrap' => false,
894
- ) );
895
-
896
- echo $ui->get_check_input( array(
897
- 'checkvalue' => 'trackbacks',
898
- 'checked' => ( !empty( $current['supports'] ) && is_array( $current['supports'] ) && in_array( 'trackbacks', $current['supports'] ) ) ? 'true' : 'false',
899
- 'name' => 'trackbacks',
900
- 'namearray' => 'cpt_supports',
901
- 'textvalue' => 'trackbacks',
902
- 'labeltext' => __( 'Trackbacks' , 'custom-post-type-ui' ),
903
- 'helptext' => esc_attr__( 'Adds the trackbacks meta box when creating content for this custom post type', 'custom-post-type-ui' ),
904
- 'default' => true,
905
- 'wrap' => false,
906
- ) );
907
-
908
- echo $ui->get_check_input( array(
909
- 'checkvalue' => 'custom-fields',
910
- 'checked' => ( !empty( $current['supports'] ) && is_array( $current['supports'] ) && in_array( 'custom-fields', $current['supports'] ) ) ? 'true' : 'false',
911
- 'name' => 'custom-fields',
912
- 'namearray' => 'cpt_supports',
913
- 'textvalue' => 'custom-fields',
914
- 'labeltext' => __( 'Custom Fields' , 'custom-post-type-ui' ),
915
- 'helptext' => esc_attr__( 'Adds the custom fields meta box when creating content for this custom post type', 'custom-post-type-ui' ),
916
- 'default' => true,
917
- 'wrap' => false,
918
- ) );
919
-
920
- echo $ui->get_check_input( array(
921
- 'checkvalue' => 'comments',
922
- 'checked' => ( !empty( $current['supports'] ) && is_array( $current['supports'] ) && in_array( 'comments', $current['supports'] ) ) ? 'true' : 'false',
923
- 'name' => 'comments',
924
- 'namearray' => 'cpt_supports',
925
- 'textvalue' => 'comments',
926
- 'labeltext' => __( 'Comments' , 'custom-post-type-ui' ),
927
- 'helptext' => esc_attr__( 'Adds the comments meta box when creating content for this custom post type', 'custom-post-type-ui' ),
928
- 'default' => true,
929
- 'wrap' => false,
930
- ) );
931
-
932
- echo $ui->get_check_input( array(
933
- 'checkvalue' => 'revisions',
934
- 'checked' => ( !empty( $current['supports'] ) && is_array( $current['supports'] ) && in_array( 'revisions', $current['supports'] ) ) ? 'true' : 'false',
935
- 'name' => 'revisions',
936
- 'namearray' => 'cpt_supports',
937
- 'textvalue' => 'revisions',
938
- 'labeltext' => __( 'Revisions' , 'custom-post-type-ui' ),
939
- 'helptext' => esc_attr__( 'Adds the revisions meta box when creating content for this custom post type', 'custom-post-type-ui' ),
940
- 'default' => true,
941
- 'wrap' => false,
942
- ) );
943
-
944
- echo $ui->get_check_input( array(
945
- 'checkvalue' => 'author',
946
- 'checked' => ( !empty( $current['supports'] ) && is_array( $current['supports'] ) && in_array( 'author', $current['supports'] ) ) ? 'true' : 'false',
947
- 'name' => 'author',
948
- 'namearray' => 'cpt_supports',
949
- 'textvalue' => 'author',
950
- 'labeltext' => __( 'Author' , 'custom-post-type-ui' ),
951
- 'helptext' => esc_attr__( 'Adds the author meta box when creating content for this custom post type', 'custom-post-type-ui' ),
952
- 'default' => true,
953
- 'wrap' => false,
954
- ) );
955
-
956
- echo $ui->get_check_input( array(
957
- 'checkvalue' => 'page-attributes',
958
- 'checked' => ( !empty( $current['supports'] ) && is_array( $current['supports'] ) && in_array( 'page-attributes', $current['supports'] ) ) ? 'true' : 'false',
959
- 'name' => 'page-attributes',
960
- 'namearray' => 'cpt_supports',
961
- 'textvalue' => 'page-attributes',
962
- 'labeltext' => __( 'Page Attributes' , 'custom-post-type-ui' ),
963
- 'helptext' => esc_attr__( 'Adds the page attribute meta box when creating content for this custom post type', 'custom-post-type-ui' ),
964
- 'default' => true,
965
- 'wrap' => false,
966
- ) );
967
-
968
- echo $ui->get_check_input( array(
969
- 'checkvalue' => 'post-formats',
970
- 'checked' => ( !empty( $current['supports'] ) && is_array( $current['supports'] ) && in_array( 'post-formats', $current['supports'] ) ) ? 'true' : 'false',
971
- 'name' => 'post-formats',
972
- 'namearray' => 'cpt_supports',
973
- 'textvalue' => 'post-formats',
974
- 'labeltext' => __( 'Post Formats' , 'custom-post-type-ui' ),
975
- 'helptext' => esc_attr__( 'Adds post format support', 'custom-post-type-ui' ),
976
- 'default' => true,
977
- 'wrap' => false,
978
- ) );
979
-
980
- echo $ui->get_p( __( 'Use the option below to explicitly set "supports" to false.', 'custom-post-type-ui' ) );
981
-
982
- echo $ui->get_check_input( array(
983
- 'checkvalue' => 'none',
984
- 'checked' => ( !empty( $current['supports'] ) && ( is_array( $current['supports'] ) && in_array( 'none', $current['supports'] ) ) ) ? 'true' : 'false',
985
- 'name' => 'none',
986
- 'namearray' => 'cpt_supports',
987
- 'textvalue' => 'none',
988
- 'labeltext' => __( 'None' , 'custom-post-type-ui' ),
989
- 'helptext' => esc_attr__( 'Remove all support features', 'custom-post-type-ui' ),
990
- 'default' => false,
991
- 'wrap' => false,
992
- ) );
993
-
994
- echo $ui->get_fieldset_end() . $ui->get_td_end() . $ui->get_tr_end();
995
-
996
- echo $ui->get_tr_start() . $ui->get_th_start() . __( 'Custom "Supports"', 'custom-post-type-ui' );
997
- echo $ui->get_p( __( 'Use this input to register custom "supports" values, separated by commas.', 'custom-post-type-ui' ) );
998
- echo $ui->get_th_end() . $ui->get_td_start();
999
- echo $ui->get_text_input( array(
1000
- 'namearray' => 'cpt_custom_post_type',
1001
- 'name' => 'custom_supports',
1002
- 'textvalue' => ( isset( $current['custom_supports'] ) ) ? esc_attr( $current['custom_supports'] ) : '',
1003
- 'helptext' => esc_attr__( 'Provide custom support slugs here.', 'custom-post-type-ui' ),
1004
- 'helptext_after'=> true,
1005
- 'wrap' => false,
1006
- ) );
1007
- echo $ui->get_td_end() . $ui->get_tr_end();
1008
-
1009
- echo $ui->get_tr_start() . $ui->get_th_start() . __( 'Built-in Taxonomies', 'custom-post-type-ui' ) . $ui->get_th_end() . $ui->get_td_start() . $ui->get_fieldset_start();
1010
-
1011
- /**
1012
- * Filters the arguments for taxonomies to list for post type association.
1013
- *
1014
- * @since 1.0.0
1015
- *
1016
- * @param array $value Array of default arguments.
1017
- */
1018
- $args = apply_filters( 'cptui_attach_taxonomies_to_post_type', array( 'public' => true ) );
1019
-
1020
- // If they don't return an array, fall back to the original default. Don't need to check for empty, because empty array is default for $args param in get_post_types anyway.
1021
- if ( !is_array( $args ) ) {
1022
- $args = array( 'public' => true );
1023
- }
1024
-
1025
- $add_taxes = get_taxonomies( $args, 'objects' );
1026
- unset( $add_taxes['nav_menu'] ); unset( $add_taxes['post_format'] );
1027
- foreach ( $add_taxes as $add_tax ) {
1028
-
1029
- $core_label = ( in_array( $add_tax->name, array( 'category', 'post_tag' ) ) ) ? __( '(WP Core)', 'custom-post-type-ui' ) : '';
1030
- echo $ui->get_check_input( array(
1031
- 'checkvalue' => $add_tax->name,
1032
- 'checked' => ( !empty( $current['taxonomies'] ) && is_array( $current['taxonomies'] ) && in_array( $add_tax->name, $current['taxonomies'] ) ) ? 'true' : 'false',
1033
- 'name' => $add_tax->name,
1034
- 'namearray' => 'cpt_addon_taxes',
1035
- 'textvalue' => $add_tax->name,
1036
- 'labeltext' => $add_tax->label . ' ' . $core_label,
1037
- 'helptext' => sprintf( esc_attr__( 'Adds %s support', 'custom-post-type-ui' ), $add_tax->label ),
1038
- 'wrap' => false
1039
- ) );
1040
- }
1041
- echo $ui->get_fieldset_end() . $ui->get_td_end() . $ui->get_tr_end();
1042
- ?>
1043
- </table>
1044
- <?php echo $ui->get_fieldset_end();
1045
-
1046
- /**
1047
- * Fires after the default fieldsets on the post editor screen.
1048
- *
1049
- * @since 1.3.0
1050
- *
1051
- * @param cptui_admin_ui $ui Admin UI instance.
1052
- */
1053
- do_action( 'cptui_post_type_after_fieldsets', $ui ); ?>
1054
  </div>
1055
- <p>
1056
- <?php
1057
- if ( ! empty( $_GET ) && ! empty( $_GET['action'] ) && 'edit' == $_GET['action'] ) {
1058
- /**
1059
- * Filters the text value to use on the button when editing.
1060
- *
1061
- * @since 1.0.0
1062
- *
1063
- * @param string $value Text to use for the button.
1064
- */
1065
- ?>
1066
- <input type="submit" class="button-primary" name="cpt_submit" value="<?php echo esc_attr( apply_filters( 'cptui_post_type_submit_edit', __( 'Save Post Type', 'custom-post-type-ui' ) ) ); ?>" />
1067
- <?php
1068
-
1069
- /**
1070
- * Filters the text value to use on the button when deleting.
1071
- *
1072
- * @since 1.0.0
1073
- *
1074
- * @param string $value Text to use for the button.
1075
- */
1076
- ?>
1077
- <input type="submit" class="button-secondary" name="cpt_delete" id="cpt_submit_delete" value="<?php echo esc_attr( apply_filters( 'cptui_post_type_submit_delete', __( 'Delete Post Type', 'custom-post-type-ui' ) ) ); ?>" />
1078
- <?php
1079
- } else {
1080
-
1081
- /**
1082
- * Filters the text value to use on the button when adding.
1083
- *
1084
- * @since 1.0.0
1085
- *
1086
- * @param string $value Text to use for the button.
1087
- */
1088
- ?>
1089
- <input type="submit" class="button-primary" name="cpt_submit" value="<?php echo esc_attr( apply_filters( 'cptui_post_type_submit_add', __( 'Add Post Type', 'custom-post-type-ui' ) ) ); ?>" />
1090
- <?php } ?>
1091
- </p>
1092
  </form>
1093
  </div><!-- End .wrap -->
1094
  <?php
@@ -1100,19 +1127,17 @@ function cptui_manage_post_types() {
1100
  * @since 1.0.0
1101
  *
1102
  * @param array $post_types Array of post types that are registered.
1103
- *
1104
- * @return string HTML select dropdown.
1105
  */
1106
  function cptui_post_types_dropdown( $post_types = array() ) {
1107
 
1108
  $ui = new cptui_admin_ui();
1109
 
1110
- if ( !empty( $post_types ) ) {
1111
  $select = array();
1112
  $select['options'] = array();
1113
 
1114
- foreach( $post_types as $type ) {
1115
- $text = ( !empty( $type['label'] ) ) ? $type['label'] : $type['name'];
1116
  $select['options'][] = array( 'attr' => $type['name'], 'text' => $text );
1117
  }
1118
 
@@ -1123,7 +1148,7 @@ function cptui_post_types_dropdown( $post_types = array() ) {
1123
  'namearray' => 'cptui_selected_post_type',
1124
  'name' => 'post_type',
1125
  'selections' => $select,
1126
- 'wrap' => false
1127
  ) );
1128
  }
1129
  }
@@ -1146,21 +1171,17 @@ function cptui_get_current_post_type( $post_type_deleted = false ) {
1146
  if ( ! empty( $_POST ) ) {
1147
  if ( isset( $_POST['cptui_selected_post_type']['post_type'] ) ) {
1148
  $type = sanitize_text_field( $_POST['cptui_selected_post_type']['post_type'] );
1149
- }
1150
-
1151
- if ( $post_type_deleted ) {
1152
  $post_types = cptui_get_post_type_data();
1153
  $type = key( $post_types );
1154
- }
1155
-
1156
- if ( isset( $_POST['cpt_custom_post_type']['name'] ) ) {
1157
  $type = sanitize_text_field( $_POST['cpt_custom_post_type']['name'] );
1158
  }
1159
- } else if ( !empty( $_GET ) && isset( $_GET['cptui_post_type'] ) ) {
1160
  $type = sanitize_text_field( $_GET['cptui_post_type'] );
1161
  } else {
1162
  $post_types = cptui_get_post_type_data();
1163
- if ( !empty( $post_types ) ) {
1164
  // Will return the first array key.
1165
  $type = key( $post_types );
1166
  }
@@ -1183,7 +1204,7 @@ function cptui_get_current_post_type( $post_type_deleted = false ) {
1183
  *
1184
  * @internal
1185
  *
1186
- * @param $data array $_POST values.
1187
  *
1188
  * @return bool|string False on failure, string on success.
1189
  */
@@ -1193,12 +1214,12 @@ function cptui_delete_post_type( $data = array() ) {
1193
  if ( is_string( $data ) && cptui_get_post_type_exists( $data, $data ) ) {
1194
  $data = array(
1195
  'cpt_custom_post_type' => array(
1196
- 'name' => $data
1197
- )
1198
  );
1199
  }
1200
 
1201
- if ( empty( $data['cpt_custom_post_type']['name'] ) || ! cptui_get_post_type_exists( $data['cpt_custom_post_type']['name'], $data ) ) {
1202
  return cptui_admin_notices( 'error', '', false, __( 'Please provide a post type to delete', 'custom-post-type-ui' ) );
1203
  }
1204
 
@@ -1244,9 +1265,9 @@ function cptui_delete_post_type( $data = array() ) {
1244
  set_transient( 'cptui_flush_rewrite_rules', 'true', 5 * 60 );
1245
 
1246
  if ( isset( $success ) ) {
1247
- return cptui_admin_notices( 'delete', $data['cpt_custom_post_type']['name'], $success );
1248
  }
1249
- return false;
1250
  }
1251
 
1252
  /**
@@ -1276,14 +1297,14 @@ function cptui_update_post_type( $data = array() ) {
1276
  return cptui_admin_notices( 'error', '', false, __( 'Please provide a post type name', 'custom-post-type-ui' ) );
1277
  }
1278
 
1279
- if ( !empty( $data['cpt_original'] ) && $data['cpt_original'] != $data['cpt_custom_post_type']['name'] ) {
1280
- if ( !empty( $data['update_post_types'] ) ) {
1281
  cptui_convert_post_type_posts( $data['cpt_original'], $data['cpt_custom_post_type']['name'] );
1282
  }
1283
  }
1284
 
1285
- // clean up $_POST data.
1286
- foreach( $data as $key => $value ) {
1287
  if ( is_string( $value ) ) {
1288
  $data[ $key ] = sanitize_text_field( $value );
1289
  } else {
@@ -1297,7 +1318,8 @@ function cptui_update_post_type( $data = array() ) {
1297
  false !== strpos( $data['cpt_custom_post_type']['rewrite_slug'], '\'' ) ||
1298
  false !== strpos( $data['cpt_custom_post_type']['rewrite_slug'], '\"' ) ) {
1299
 
1300
- return cptui_admin_notices( 'error', '', false, __( 'Please do not use quotes in post type names or rewrite slugs', 'custom-post-type-ui' ) );
 
1301
  }
1302
 
1303
  $post_types = cptui_get_post_type_data();
@@ -1315,22 +1337,24 @@ function cptui_update_post_type( $data = array() ) {
1315
  $slug_as_page = cptui_check_page_slugs( $data['cpt_custom_post_type']['name'] );
1316
  if ( 'new' == $data['cpt_type_status'] ) {
1317
  if ( true === $slug_exists ) {
1318
- return cptui_admin_notices( 'error', '', false, sprintf( __( 'Please choose a different post type name. %s is already registered.', 'custom-post-type-ui' ), $data['cpt_custom_post_type']['name'] ) );
 
1319
  }
1320
  if ( true === $slug_as_page ) {
1321
- return cptui_admin_notices( 'error', '', false, sprintf( __( 'Please choose a different post type name. %s matches an existing page slug, which can cause conflicts.', 'custom-post-type-ui' ), $data['cpt_custom_post_type']['name'] ) );
 
1322
  }
1323
  }
1324
 
1325
- if ( empty( $data['cpt_addon_taxes'] ) || !is_array( $data['cpt_addon_taxes'] ) ) {
1326
  $data['cpt_addon_taxes'] = array();
1327
  }
1328
 
1329
- if ( empty( $data['cpt_supports'] ) || !is_array( $data['cpt_supports'] ) ) {
1330
  $data['cpt_supports'] = array();
1331
  }
1332
 
1333
- foreach( $data['cpt_labels'] as $key => $label ) {
1334
  if ( empty( $label ) ) {
1335
  unset( $data['cpt_labels'][ $key ] );
1336
  }
@@ -1338,7 +1362,11 @@ function cptui_update_post_type( $data = array() ) {
1338
  $label = str_replace( '"', '', htmlspecialchars_decode( $label ) );
1339
  $label = htmlspecialchars( $label, ENT_QUOTES );
1340
  $label = trim( $label );
1341
- $data['cpt_labels'][ $key ] = stripslashes_deep( $label );
 
 
 
 
1342
  }
1343
 
1344
  if ( empty( $data['cpt_custom_post_type']['menu_icon'] ) ) {
@@ -1375,6 +1403,7 @@ function cptui_update_post_type( $data = array() ) {
1375
  'singular_label' => $singular_label,
1376
  'description' => $description,
1377
  'public' => disp_boolean( $data['cpt_custom_post_type']['public'] ),
 
1378
  'show_ui' => disp_boolean( $data['cpt_custom_post_type']['show_ui'] ),
1379
  'show_in_nav_menus' => disp_boolean( $data['cpt_custom_post_type']['show_in_nav_menus'] ),
1380
  'show_in_rest' => disp_boolean( $data['cpt_custom_post_type']['show_in_rest'] ),
@@ -1426,10 +1455,10 @@ function cptui_update_post_type( $data = array() ) {
1426
 
1427
  if ( isset( $success ) ) {
1428
  if ( 'new' == $data['cpt_type_status'] ) {
1429
- return cptui_admin_notices( 'add', $data['cpt_custom_post_type']['name'], $success );
1430
  }
1431
  }
1432
- return cptui_admin_notices( 'update', $data['cpt_custom_post_type']['name'], true );
1433
  }
1434
 
1435
  /**
@@ -1491,9 +1520,12 @@ function cptui_convert_post_type_posts( $original_slug = '', $new_slug = '' ) {
1491
  );
1492
  $convert = new WP_Query( $args );
1493
 
1494
- if ( $convert->have_posts() ) : while ( $convert->have_posts() ) : $convert->the_post();
1495
- set_post_type( get_the_ID(), $new_slug );
1496
- endwhile; endif;
 
 
 
1497
 
1498
  cptui_delete_post_type( $original_slug );
1499
  }
@@ -1558,3 +1590,40 @@ function cptui_check_page_slugs( $post_type_slug = '' ) {
1558
 
1559
  return false;
1560
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
  'text' => __( 'Edit Post Types', 'custom-post-type-ui' ),
85
  'classes' => $classes,
86
  'url' => esc_url( add_query_arg( array( 'action' => 'edit' ), cptui_admin_url( 'admin.php?page=cptui_manage_' . $current_page ) ) ),
87
+ 'aria-selected' => ( ! empty( $action ) ) ? 'true' : 'false',
88
  );
89
 
90
  $tabs['tabs']['view'] = array(
93
  'url' => esc_url( cptui_admin_url( 'admin.php?page=cptui_listings#post-types' ) ),
94
  'aria-selected' => 'false',
95
  );
96
+
97
+ $tabs['tabs']['export'] = array(
98
+ 'text' => __( 'Import/Export Post Types', 'custom-post-type-ui' ),
99
+ 'classes' => array( 'nav-tab' ), // Prevent notices.
100
+ 'url' => esc_url( cptui_admin_url( 'admin.php?page=cptui_importexport' ) ),
101
+ 'aria-selected' => 'false',
102
+ );
103
  }
104
  }
105
 
116
  */
117
  function cptui_manage_post_types() {
118
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
  $tab = ( ! empty( $_GET ) && ! empty( $_GET['action'] ) && 'edit' === $_GET['action'] ) ? 'edit' : 'new';
120
  $tab_class = 'cptui-' . $tab; ?>
121
 
129
  */
130
  do_action( 'cptui_inside_post_type_wrap' );
131
 
132
+ /**
133
+ * Filters whether or not a post type was deleted.
134
+ *
135
+ * @since 1.4.0
136
+ *
137
+ * @param bool $value Whether or not post type deleted. Default false.
138
+ */
139
+ $post_type_deleted = apply_filters( 'cptui_post_type_deleted', false );
140
 
141
  cptui_settings_tab_menu();
142
 
192
  } ?>
193
 
194
  <form class="posttypesui" method="post" action="<?php echo esc_url( cptui_get_post_form_action( $ui ) ); ?>">
195
+ <div class="postbox-container">
196
+ <div id="poststuff">
197
+ <div class="cptui-section postbox">
198
+ <button type="button" class="handlediv button-link" aria-expanded="true">
199
+ <span class="screen-reader-text"><?php esc_html_e( 'Toggle panel: Basic settings', 'custom-post-type-ui' ); ?></span>
200
+ <span class="toggle-indicator" aria-hidden="true"></span>
201
+ </button>
202
+ <h2 class="hndle">
203
+ <span><?php esc_html_e( 'Basic settings', 'custom-post-type-ui' ); ?></span>
204
+ </h2>
205
+ <div class="inside">
206
+ <div class="main">
207
+ <table class="form-table cptui-table">
208
+ <?php
209
+ echo $ui->get_tr_start() . $ui->get_th_start();
210
+ echo $ui->get_label( 'name', esc_html__( 'Post Type Slug', 'custom-post-type-ui' ) );
211
+ echo $ui->get_required_span();
212
+
213
+ if ( 'edit' == $tab ) {
214
+ echo '<p id="slugchanged" class="hidemessage">' . __( 'Slug has changed', 'custom_post_type_ui' ) . '</p>';
215
+ }
216
+
217
+ echo $ui->get_th_end() . $ui->get_td_start();
218
+
219
+ echo $ui->get_text_input( array(
220
+ 'namearray' => 'cpt_custom_post_type',
221
+ 'name' => 'name',
222
+ 'textvalue' => ( isset( $current['name'] ) ) ? esc_attr( $current['name'] ) : '',
223
+ 'maxlength' => '20',
224
+ 'helptext' => esc_html__( 'The post type name/slug. Used for various queries for post type content.', 'custom-post-type-ui' ),
225
+ 'required' => true,
226
+ 'placeholder' => false,
227
+ 'wrap' => false,
228
+ ) );
229
+ echo '<p class="cptui-slug-details">';
230
+ esc_html_e( 'Slugs should only contain alphanumeric, latin characters. Underscores or dashes should be used in place of spaces.', 'custom-post-type-ui' );
231
  echo '</p>';
232
 
233
+ if ( 'edit' == $tab ) {
234
+ echo '<p>';
235
+ esc_html_e( 'DO NOT EDIT the post type slug unless also planning to migrate posts. Changing the slug registers a new post type entry.', 'custom-post-type-ui' );
236
+ echo '</p>';
237
+
238
+ echo '<div class="cptui-spacer">';
239
+ echo $ui->get_check_input( array(
240
+ 'checkvalue' => 'update_post_types',
241
+ 'checked' => 'false',
242
+ 'name' => 'update_post_types',
243
+ 'namearray' => 'update_post_types',
244
+ 'labeltext' => esc_html__( 'Migrate posts to newly renamed post type?', 'custom-post-type-ui' ),
245
+ 'helptext' => false,
246
+ 'default' => false,
247
+ 'wrap' => false,
248
+ ) );
249
+ echo '</div>';
250
+ }
251
+
252
+ echo $ui->get_td_end(); echo $ui->get_tr_end();
253
+
254
+ echo $ui->get_text_input( array(
255
+ 'namearray' => 'cpt_custom_post_type',
256
+ 'name' => 'label',
257
+ 'textvalue' => ( isset( $current['label'] ) ) ? esc_attr( $current['label'] ) : '',
258
+ 'labeltext' => esc_html__( 'Plural Label', 'custom-post-type-ui' ),
259
+ 'aftertext' => esc_html__( '(e.g. Movies)', 'custom-post-type-ui' ),
260
+ 'helptext' => esc_html__( 'Used for the post type admin menu item.', 'custom-post-type-ui' ),
261
+ 'required' => true,
262
  ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
263
 
264
+ echo $ui->get_text_input( array(
265
+ 'namearray' => 'cpt_custom_post_type',
266
+ 'name' => 'singular_label',
267
+ 'textvalue' => ( isset( $current['singular_label'] ) ) ? esc_attr( $current['singular_label'] ) : '',
268
+ 'labeltext' => esc_html__( 'Singular Label', 'custom-post-type-ui' ),
269
+ 'aftertext' => esc_html__( '(e.g. Movie)', 'custom-post-type-ui' ),
270
+ 'helptext' => esc_html__( 'Used when a singular label is needed.', 'custom-post-type-ui' ),
271
+ 'required' => true,
272
+ ) );
273
+ ?>
274
+ </table>
275
+ <p class="submit">
276
+ <?php wp_nonce_field( 'cptui_addedit_post_type_nonce_action', 'cptui_addedit_post_type_nonce_field' );
277
+ if ( ! empty( $_GET ) && ! empty( $_GET['action'] ) && 'edit' == $_GET['action'] ) { ?>
278
+ <?php
279
+
280
+ /**
281
+ * Filters the text value to use on the button when editing.
282
+ *
283
+ * @since 1.0.0
284
+ *
285
+ * @param string $value Text to use for the button.
286
+ */
287
+ ?>
288
+ <input type="submit" class="button-primary" name="cpt_submit" value="<?php echo esc_attr( apply_filters( 'cptui_post_type_submit_edit', __( 'Save Post Type', 'custom-post-type-ui' ) ) ); ?>" />
289
+ <?php
290
+
291
+ /**
292
+ * Filters the text value to use on the button when deleting.
293
+ *
294
+ * @since 1.0.0
295
+ *
296
+ * @param string $value Text to use for the button.
297
+ */
298
+ ?>
299
+ <input type="submit" class="button-secondary" name="cpt_delete" id="cpt_submit_delete" value="<?php echo esc_attr( apply_filters( 'cptui_post_type_submit_delete', __( 'Delete Post Type', 'custom-post-type-ui' ) ) ); ?>" />
300
+ <?php } else { ?>
301
+ <?php
302
+
303
+ /**
304
+ * Filters the text value to use on the button when adding.
305
+ *
306
+ * @since 1.0.0
307
+ *
308
+ * @param string $value Text to use for the button.
309
+ */
310
+ ?>
311
+ <input type="submit" class="button-primary" name="cpt_submit" value="<?php echo esc_attr( apply_filters( 'cptui_post_type_submit_add', __( 'Add Post Type', 'custom-post-type-ui' ) ) ); ?>" />
312
+ <?php }
313
+
314
+ if ( ! empty( $current ) ) { ?>
315
+ <input type="hidden" name="cpt_original" id="cpt_original" value="<?php esc_attr_e( $current['name'] ); ?>" />
316
+ <?php }
317
+
318
+ // Used to check and see if we should prevent duplicate slugs. ?>
319
+ <input type="hidden" name="cpt_type_status" id="cpt_type_status" value="<?php esc_attr_e( $tab ); ?>" />
320
+ </p>
321
+ </div>
322
+ </div>
323
+ </div>
324
+ <div class="cptui-section postbox">
325
+ <button type="button" class="handlediv button-link" aria-expanded="true">
326
+ <span class="screen-reader-text"><?php esc_html_e( 'Toggle panel: Additional labels', 'custom-post-type-ui' ); ?></span>
327
+ <span class="toggle-indicator" aria-hidden="true"></span>
328
+ </button>
329
+ <h2 class="hndle">
330
+ <span><?php esc_html_e( 'Additional labels', 'custom-post-type-ui' ); ?></span>
331
+ </h2>
332
+ <div class="inside">
333
+ <div class="main">
334
+ <table class="form-table cptui-table">
335
+ <?php
336
+
337
+ if ( isset( $current['description'] ) ) {
338
+ $current['description'] = stripslashes_deep( $current['description'] );
339
+ }
340
+ echo $ui->get_textarea_input( array(
341
+ 'namearray' => 'cpt_custom_post_type',
342
+ 'name' => 'description',
343
+ 'rows' => '4',
344
+ 'cols' => '40',
345
+ 'textvalue' => ( isset( $current['description'] ) ) ? esc_textarea( $current['description'] ) : '',
346
+ 'labeltext' => esc_html__( 'Post Type Description', 'custom-post-type-ui' ),
347
+ 'helptext' => esc_html__( 'Perhaps describe what your custom post type is used for?', 'custom-post-type-ui' ),
348
+ ) );
349
+
350
+ echo $ui->get_text_input( array(
351
+ 'labeltext' => esc_html__( 'Menu Name', 'custom-post-type-ui' ),
352
+ 'helptext' => esc_html__( 'Custom admin menu name for your custom post type.', 'custom-post-type-ui' ),
353
+ 'namearray' => 'cpt_labels',
354
+ 'name' => 'menu_name',
355
+ 'textvalue' => ( isset( $current['labels']['menu_name'] ) ) ? esc_attr( $current['labels']['menu_name'] ) : '',
356
+ 'aftertext' => esc_html__( '(e.g. My Movies)', 'custom-post-type-ui' ),
357
+ ) );
358
+
359
+ echo $ui->get_text_input( array(
360
+ 'labeltext' => esc_html__( 'All Items', 'custom-post-type-ui' ),
361
+ 'helptext' => esc_html__( 'Used in the post type admin submenu.', 'custom-post-type-ui' ),
362
+ 'namearray' => 'cpt_labels',
363
+ 'name' => 'all_items',
364
+ 'textvalue' => ( isset( $current['labels']['all_items'] ) ) ? esc_attr( $current['labels']['all_items'] ) : '',
365
+ 'aftertext' => esc_html__( '(e.g. All Movies)', 'custom-post-type-ui' ),
366
+ ) );
367
+
368
+ echo $ui->get_text_input( array(
369
+ 'labeltext' => esc_html__( 'Add New', 'custom-post-type-ui' ),
370
+ 'helptext' => esc_html__( 'Used in the post type admin submenu.', 'custom-post-type-ui' ),
371
+ 'namearray' => 'cpt_labels',
372
+ 'name' => 'add_new',
373
+ 'textvalue' => ( isset( $current['labels']['add_new'] ) ) ? esc_attr( $current['labels']['add_new'] ) : '',
374
+ 'aftertext' => esc_html__( '(e.g. Add New)', 'custom-post-type-ui' ),
375
+ ) );
376
+
377
+ echo $ui->get_text_input( array(
378
+ 'labeltext' => esc_html__( 'Add New Item', 'custom-post-type-ui' ),
379
+ 'helptext' => esc_html__( 'Used at the top of the post editor screen for a new post type post.', 'custom-post-type-ui' ),
380
+ 'namearray' => 'cpt_labels',
381
+ 'name' => 'add_new_item',
382
+ 'textvalue' => ( isset( $current['labels']['add_new_item'] ) ) ? esc_attr( $current['labels']['add_new_item'] ) : '',
383
+ 'aftertext' => esc_html__( '(e.g. Add New Movie)', 'custom-post-type-ui' ),
384
+ ) );
385
+
386
+ echo $ui->get_text_input( array(
387
+ 'labeltext' => esc_html__( 'Edit Item', 'custom-post-type-ui' ),
388
+ 'helptext' => esc_html__( 'Used at the top of the post editor screen for an existing post type post.', 'custom-post-type-ui' ),
389
+ 'namearray' => 'cpt_labels',
390
+ 'name' => 'edit_item',
391
+ 'textvalue' => ( isset( $current['labels']['edit_item'] ) ) ? esc_attr( $current['labels']['edit_item'] ) : '',
392
+ 'aftertext' => esc_html__( '(e.g. Edit Movie)', 'custom-post-type-ui' ),
393
+ ) );
394
+
395
+ echo $ui->get_text_input( array(
396
+ 'labeltext' => esc_html__( 'New Item', 'custom-post-type-ui' ),
397
+ 'helptext' => esc_html__( 'Post type label. Used in the admin menu for displaying post types.', 'custom-post-type-ui' ),
398
+ 'namearray' => 'cpt_labels',
399
+ 'name' => 'new_item',
400
+ 'textvalue' => ( isset( $current['labels']['new_item'] ) ) ? esc_attr( $current['labels']['new_item'] ) : '',
401
+ 'aftertext' => esc_html__( '(e.g. New Movie)', 'custom-post-type-ui' ),
402
+ ) );
403
+
404
+ echo $ui->get_text_input( array(
405
+ 'labeltext' => esc_html__( 'View Item', 'custom-post-type-ui' ),
406
+ 'helptext' => esc_html__( 'Used in the admin bar when viewing editor screen for a published post in the post type.', 'custom-post-type-ui' ),
407
+ 'namearray' => 'cpt_labels',
408
+ 'name' => 'view_item',
409
+ 'textvalue' => ( isset( $current['labels']['view_item'] ) ) ? esc_attr( $current['labels']['view_item'] ) : '',
410
+ 'aftertext' => esc_html__( '(e.g. View Movie)', 'custom-post-type-ui' ),
411
+ ) );
412
+
413
+ echo $ui->get_text_input( array(
414
+ 'labeltext' => esc_html__( 'Search Item', 'custom-post-type-ui' ),
415
+ 'helptext' => esc_html__( 'Used as the text for the search button on post type list screen.', 'custom-post-type-ui' ),
416
+ 'namearray' => 'cpt_labels',
417
+ 'name' => 'search_items',
418
+ 'textvalue' => ( isset( $current['labels']['search_items'] ) ) ? esc_attr( $current['labels']['search_items'] ) : '',
419
+ 'aftertext' => esc_html__( '(e.g. Search Movie)', 'custom-post-type-ui' ),
420
+ ) );
421
+
422
+ echo $ui->get_text_input( array(
423
+ 'labeltext' => esc_html__( 'Not Found', 'custom-post-type-ui' ),
424
+ 'helptext' => esc_html__( 'Used when there are no posts to display on the post type list screen.', 'custom-post-type-ui' ),
425
+ 'namearray' => 'cpt_labels',
426
+ 'name' => 'not_found',
427
+ 'textvalue' => ( isset( $current['labels']['not_found'] ) ) ? esc_attr( $current['labels']['not_found'] ) : '',
428
+ 'aftertext' => esc_html__( '(e.g. No Movies found)', 'custom-post-type-ui' ),
429
+ ) );
430
+
431
+ echo $ui->get_text_input( array(
432
+ 'labeltext' => esc_html__( 'Not Found in Trash', 'custom-post-type-ui' ),
433
+ 'helptext' => esc_html__( 'Used when there are no posts to display on the post type list trash screen.', 'custom-post-type-ui' ),
434
+ 'namearray' => 'cpt_labels',
435
+ 'name' => 'not_found_in_trash',
436
+ 'textvalue' => ( isset( $current['labels']['not_found_in_trash'] ) ) ? esc_attr( $current['labels']['not_found_in_trash'] ) : '',
437
+ 'aftertext' => esc_html__( '(e.g. No Movies found in Trash)', 'custom-post-type-ui' ),
438
+ ) );
439
+
440
+ // As of 1.4.0, this will register into `parent_item_colon` paramter upon registration and export.
441
+ echo $ui->get_text_input( array(
442
+ 'labeltext' => esc_html__( 'Parent', 'custom-post-type-ui' ),
443
+ 'helptext' => esc_html__( 'Used for hierarchical types that need a colon.', 'custom-post-type-ui' ),
444
+ 'namearray' => 'cpt_labels',
445
+ 'name' => 'parent',
446
+ 'textvalue' => ( isset( $current['labels']['parent'] ) ) ? esc_attr( $current['labels']['parent'] ) : '',
447
+ 'aftertext' => esc_html__( '(e.g. Parent Movie:)', 'custom-post-type-ui' ),
448
+ ) );
449
+
450
+ echo $ui->get_text_input( array(
451
+ 'labeltext' => esc_html__( 'Featured Image', 'custom-post-type-ui' ),
452
+ 'helptext' => esc_html__( 'Used as the "Featured Image" phrase for the post type.', 'custom-post-type-ui' ),
453
+ 'namearray' => 'cpt_labels',
454
+ 'name' => 'featured_image',
455
+ 'textvalue' => ( isset( $current['labels']['featured_image'] ) ) ? esc_attr( $current['labels']['featured_image'] ) : '',
456
+ 'aftertext' => esc_html__( '(e.g. Featured image for this movie)', 'custom-post-type-ui' ),
457
+ ) );
458
+
459
+ echo $ui->get_text_input( array(
460
+ 'labeltext' => esc_html__( 'Set Featured Image', 'custom-post-type-ui' ),
461
+ 'helptext' => esc_html__( 'Used as the "Set featured image" phrase for the post type.', 'custom-post-type-ui' ),
462
+ 'namearray' => 'cpt_labels',
463
+ 'name' => 'set_featured_image',
464
+ 'textvalue' => ( isset( $current['labels']['set_featured_image'] ) ) ? esc_attr( $current['labels']['set_featured_image'] ) : '',
465
+ 'aftertext' => esc_html__( '(e.g. Set featured image for this movie)', 'custom-post-type-ui' ),
466
+ ) );
467
+
468
+ echo $ui->get_text_input( array(
469
+ 'labeltext' => esc_html__( 'Remove Featured Image', 'custom-post-type-ui' ),
470
+ 'helptext' => esc_html__( 'Used as the "Remove featured image" phrase for the post type.', 'custom-post-type-ui' ),
471
+ 'namearray' => 'cpt_labels',
472
+ 'name' => 'remove_featured_image',
473
+ 'textvalue' => ( isset( $current['labels']['remove_featured_image'] ) ) ? esc_attr( $current['labels']['remove_featured_image'] ) : '',
474
+ 'aftertext' => esc_html__( '(e.g. Remove featured image for this movie)', 'custom-post-type-ui' ),
475
+ ) );
476
+
477
+ echo $ui->get_text_input( array(
478
+ 'labeltext' => esc_html__( 'Use Featured Image', 'custom-post-type-ui' ),
479
+ 'helptext' => esc_html__( 'Used as the "Use as featured image" phrase for the post type.', 'custom-post-type-ui' ),
480
+ 'namearray' => 'cpt_labels',
481
+ 'name' => 'use_featured_image',
482
+ 'textvalue' => ( isset( $current['labels']['use_featured_image'] ) ) ? esc_attr( $current['labels']['use_featured_image'] ) : '',
483
+ 'aftertext' => esc_html__( '(e.g. Use as featured image for this movie)', 'custom-post-type-ui' ),
484
+ ) );
485
+
486
+ echo $ui->get_text_input( array(
487
+ 'labeltext' => esc_html__( 'Archives', 'custom-post-type-ui' ),
488
+ 'helptext' => esc_html__( 'Post type archive label used in nav menus.', 'custom-post-type-ui' ),
489
+ 'namearray' => 'cpt_labels',
490
+ 'name' => 'archives',
491
+ 'textvalue' => ( isset( $current['labels']['archives'] ) ) ? esc_attr( $current['labels']['archives'] ) : '',
492
+ 'aftertext' => esc_html__( '(e.g. Movie archives)', 'custom-post-type-ui' ),
493
+ ) );
494
+
495
+ echo $ui->get_text_input( array(
496
+ 'labeltext' => esc_html__( 'Insert into item', 'custom-post-type-ui' ),
497
+ 'helptext' => esc_html__( 'Used as the "Insert into post" or "Insert into page" phrase for the post type.', 'custom-post-type-ui' ),
498
+ 'namearray' => 'cpt_labels',
499
+ 'name' => 'insert_into_item',
500
+ 'textvalue' => ( isset( $current['labels']['insert_into_item'] ) ) ? esc_attr( $current['labels']['insert_into_item'] ) : '',
501
+ 'aftertext' => esc_html__( '(e.g. Insert into movie)', 'custom-post-type-ui' ),
502
+ ) );
503
+
504
+ echo $ui->get_text_input( array(
505
+ 'labeltext' => esc_html__( 'Uploaded to this Item', 'custom-post-type-ui' ),
506
+ 'helptext' => esc_html__( 'Used as the "Uploaded to this post" or "Uploaded to this page" phrase for the post type.', 'custom-post-type-ui' ),
507
+ 'namearray' => 'cpt_labels',
508
+ 'name' => 'uploaded_to_this_item',
509
+ 'textvalue' => ( isset( $current['labels']['uploaded_to_this_item'] ) ) ? esc_attr( $current['labels']['uploaded_to_this_item'] ) : '',
510
+ 'aftertext' => esc_html__( '(e.g. Uploaded to this movie)', 'custom-post-type-ui' ),
511
+ ) );
512
+
513
+ echo $ui->get_text_input( array(
514
+ 'labeltext' => esc_html__( 'Filter Items List', 'custom-post-type-ui' ),
515
+ 'helptext' => esc_html__( 'Screen reader text for the filter links heading on the post type listing screen.', 'custom-post-type-ui' ),
516
+ 'namearray' => 'cpt_labels',
517
+ 'name' => 'filter_items_list',
518
+ 'textvalue' => ( isset( $current['labels']['filter_items_list'] ) ) ? esc_attr( $current['labels']['filter_items_list'] ) : '',
519
+ 'aftertext' => esc_html__( '(e.g. Filter movies list)', 'custom-post-type-ui' ),
520
+ ) );
521
+
522
+ echo $ui->get_text_input( array(
523
+ 'labeltext' => esc_html__( 'Items List Navigation', 'custom-post-type-ui' ),
524
+ 'helptext' => esc_html__( 'Screen reader text for the pagination heading on the post type listing screen.', 'custom-post-type-ui' ),
525
+ 'namearray' => 'cpt_labels',
526
+ 'name' => 'items_list_navigation',
527
+ 'textvalue' => ( isset( $current['labels']['items_list_navigation'] ) ) ? esc_attr( $current['labels']['items_list_navigation'] ) : '',
528
+ 'aftertext' => esc_html__( '(e.g. Movies list navigation)', 'custom-post-type-ui' ),
529
+ ) );
530
+
531
+ echo $ui->get_text_input( array(
532
+ 'labeltext' => esc_html__( 'Items List', 'custom-post-type-ui' ),
533
+ 'helptext' => esc_html__( 'Screen reader text for the items list heading on the post type listing screen.', 'custom-post-type-ui' ),
534
+ 'namearray' => 'cpt_labels',
535
+ 'name' => 'items_list',
536
+ 'textvalue' => ( isset( $current['labels']['items_list'] ) ) ? esc_attr( $current['labels']['items_list'] ) : '',
537
+ 'aftertext' => esc_html__( '(e.g. Movies list)', 'custom-post-type-ui' ),
538
+ ) );
539
+ ?>
540
+ </table>
541
+ </div>
542
+ </div>
543
+ </div>
544
+ <div class="cptui-section postbox">
545
+ <button type="button" class="handlediv button-link" aria-expanded="true">
546
+ <span class="screen-reader-text"><?php esc_html_e( 'Toggle panel: Settings', 'custom-post-type-ui' ); ?></span>
547
+ <span class="toggle-indicator" aria-hidden="true"></span>
548
+ </button>
549
+ <h2 class="hndle">
550
+ <span><?php esc_html_e( 'Settings', 'custom-post-type-ui' ); ?></span>
551
+ </h2>
552
+ <div class="inside">
553
+ <div class="main">
554
+ <table class="form-table cptui-table">
555
+ <?php
556
+ $select = array(
557
+ 'options' => array(
558
+ array( 'attr' => '0', 'text' => esc_attr__( 'False', 'custom-post-type-ui' ) ),
559
+ array( 'attr' => '1', 'text' => esc_attr__( 'True', 'custom-post-type-ui' ), 'default' => 'true' ),
560
+ ),
561
+ );
562
+ $selected = ( isset( $current ) ) ? disp_boolean( $current['public'] ) : '';
563
+ $select['selected'] = ( ! empty( $selected ) ) ? $current['public'] : '';
564
+ echo $ui->get_select_input( array(
565
+ 'namearray' => 'cpt_custom_post_type',
566
+ 'name' => 'public',
567
+ 'labeltext' => esc_html__( 'Public', 'custom-post-type-ui' ),
568
+ 'aftertext' => esc_html__( '(CPTUI default: true) Whether or not posts of this type should be shown in the admin UI and is publicly queryable.', 'custom-post-type-ui' ),
569
+ 'selections' => $select,
570
+ ) );
571
+
572
+ $select = array(
573
+ 'options' => array(
574
+ array( 'attr' => '0', 'text' => esc_attr__( 'False', 'custom-post-type-ui' ) ),
575
+ array( 'attr' => '1', 'text' => esc_attr__( 'True', 'custom-post-type-ui' ), 'default' => 'true' ),
576
+ ),
577
+ );
578
+ $selected = ( isset( $current ) && ! empty( $current['publicly_queryable'] ) ) ? disp_boolean( $current['publicly_queryable'] ) : '';
579
+ $select['selected'] = ( ! empty( $selected ) ) ? $current['publicly_queryable'] : '';
580
+ echo $ui->get_select_input( array(
581
+ 'namearray' => 'cpt_custom_post_type',
582
+ 'name' => 'publicly_queryable',
583
+ 'labeltext' => esc_html__( 'Publicly Queryable', 'custom-post-type-ui' ),
584
+ 'aftertext' => esc_html__( '(default: true) Whether or not queries can be performed on the front end as part of parse_request()', 'custom-post-type-ui' ),
585
+ 'selections' => $select,
586
+ ) );
587
+
588
+ $select = array(
589
+ 'options' => array(
590
+ array( 'attr' => '0', 'text' => esc_attr__( 'False', 'custom-post-type-ui' ) ),
591
+ array( 'attr' => '1', 'text' => esc_attr__( 'True', 'custom-post-type-ui' ), 'default' => 'true' ),
592
+ ),
593
+ );
594
+ $selected = ( isset( $current ) ) ? disp_boolean( $current['show_ui'] ) : '';
595
+ $select['selected'] = ( ! empty( $selected ) ) ? $current['show_ui'] : '';
596
+ echo $ui->get_select_input( array(
597
+ 'namearray' => 'cpt_custom_post_type',
598
+ 'name' => 'show_ui',
599
+ 'labeltext' => esc_html__( 'Show UI', 'custom-post-type-ui' ),
600
+ 'aftertext' => esc_html__( '(default: true) Whether or not to generate a default UI for managing this post type.', 'custom-post-type-ui' ),
601
+ 'selections' => $select,
602
+ ) );
603
+
604
+ $select = array(
605
+ 'options' => array(
606
+ array( 'attr' => '0', 'text' => esc_attr__( 'False', 'custom-post-type-ui' ) ),
607
+ array( 'attr' => '1', 'text' => esc_attr__( 'True', 'custom-post-type-ui' ), 'default' => 'true' ),
608
+ ),
609
+ );
610
+ $selected = ( isset( $current ) && ! empty( $current['show_in_nav_menus'] ) ) ? disp_boolean( $current['show_in_nav_menus'] ) : '';
611
+ $select['selected'] = ( ! empty( $selected ) && ! empty( $current['show_in_nav_menus'] ) ) ? $current['show_in_nav_menus'] : '';
612
+ echo $ui->get_select_input( array(
613
+ 'namearray' => 'cpt_custom_post_type',
614
+ 'name' => 'show_in_nav_menus',
615
+ 'labeltext' => esc_html__( 'Show in Nav Menus', 'custom-post-type-ui' ),
616
+ 'aftertext' => esc_html__( '(CPTUI default: true) Whether or not this post type is available for selection in navigation menus.', 'custom-post-type-ui' ),
617
+ 'selections' => $select,
618
+ ) );
619
+
620
+ $select = array(
621
+ 'options' => array(
622
+ array( 'attr' => '0', 'text' => esc_attr__( 'False', 'custom-post-type-ui' ), 'default' => 'false' ),
623
+ array( 'attr' => '1', 'text' => esc_attr__( 'True', 'custom-post-type-ui' ) ),
624
+ ),
625
+ );
626
+ $selected = ( isset( $current ) && ! empty( $current['show_in_rest'] ) ) ? disp_boolean( $current['show_in_rest'] ) : '';
627
+ $select['selected'] = ( ! empty( $selected ) && ! empty( $current['show_in_rest'] ) ) ? $current['show_in_rest'] : '';
628
+ echo $ui->get_select_input( array(
629
+ 'namearray' => 'cpt_custom_post_type',
630
+ 'name' => 'show_in_rest',
631
+ 'labeltext' => esc_html__( 'Show in REST API', 'custom-post-type-ui' ),
632
+ 'aftertext' => esc_html__( '(default: false) Whether or not to show this post type data in the WP REST API.', 'custom-post-type-ui' ),
633
+ 'selections' => $select,
634
+ ) );
635
+
636
+ echo $ui->get_text_input( array(
637
+ 'namearray' => 'cpt_custom_post_type',
638
+ 'name' => 'rest_base',
639
+ 'labeltext' => esc_html__( 'REST API base slug', 'custom-post-type-ui' ),
640
+ 'aftertext' => esc_attr__( 'Slug to use in REST API URLs.', 'custom-post-type-ui' ),
641
+ 'textvalue' => ( isset( $current['rest_base'] ) ) ? esc_attr( $current['rest_base'] ) : '',
642
+ ) );
643
+
644
+ echo $ui->get_tr_start() . $ui->get_th_start();
645
+ echo $ui->get_label( 'has_archive', __( 'Has Archive', 'custom-post-type-ui' ) );
646
+ echo $ui->get_p( esc_html__( 'If left blank, the archive slug will default to the post type slug.', 'custom-post-type-ui' ) );
647
+ echo $ui->get_th_end() . $ui->get_td_start();
648
+
649
+ $select = array(
650
+ 'options' => array(
651
+ array( 'attr' => '0', 'text' => esc_attr__( 'False', 'custom-post-type-ui' ), 'default' => 'true' ),
652
+ array( 'attr' => '1', 'text' => esc_attr__( 'True', 'custom-post-type-ui' ) ),
653
+ ),
654
+ );
655
+ $selected = ( isset( $current ) ) ? disp_boolean( $current['has_archive'] ) : '';
656
+ $select['selected'] = ( ! empty( $selected ) ) ? $current['has_archive'] : '';
657
+ echo $ui->get_select_input( array(
658
+ 'namearray' => 'cpt_custom_post_type',
659
+ 'name' => 'has_archive',
660
+ 'aftertext' => esc_html__( '(default: false) Whether or not the post type will have a post type archive URL.', 'custom-post-type-ui' ),
661
+ 'selections' => $select,
662
+ 'wrap' => false,
663
+ ) );
664
+
665
+ echo '<br/>';
666
+
667
+ echo $ui->get_text_input( array(
668
+ 'namearray' => 'cpt_custom_post_type',
669
+ 'name' => 'has_archive_string',
670
+ 'textvalue' => ( isset( $current['has_archive_string'] ) ) ? esc_attr( $current['has_archive_string'] ) : '',
671
+ 'aftertext' => esc_attr__( 'Slug to be used for archive URL.', 'custom-post-type-ui' ),
672
+ 'helptext_after' => true,
673
+ 'wrap' => false,
674
+ ) );
675
+ echo $ui->get_td_end() . $ui->get_tr_end();
676
+
677
+ $select = array(
678
+ 'options' => array(
679
+ array( 'attr' => '0', 'text' => esc_attr__( 'False', 'custom-post-type-ui' ), 'default' => 'true' ),
680
+ array( 'attr' => '1', 'text' => esc_attr__( 'True', 'custom-post-type-ui' ) ),
681
+ ),
682
+ );
683
+ $selected = ( isset( $current ) ) ? disp_boolean( $current['exclude_from_search'] ) : '';
684
+ $select['selected'] = ( ! empty( $selected ) ) ? $current['exclude_from_search'] : '';
685
+ echo $ui->get_select_input( array(
686
+ 'namearray' => 'cpt_custom_post_type',
687
+ 'name' => 'exclude_from_search',
688
+ 'labeltext' => esc_html__( 'Exclude From Search', 'custom-post-type-ui' ),
689
+ 'aftertext' => esc_html__( '(default: false) Whether or not to exclude posts with this post type from front end search results.', 'custom-post-type-ui' ),
690
+ 'selections' => $select,
691
+ ) );
692
+
693
+ echo $ui->get_text_input( array(
694
+ 'namearray' => 'cpt_custom_post_type',
695
+ 'name' => 'capability_type',
696
+ 'textvalue' => ( isset( $current['capability_type'] ) ) ? esc_attr( $current['capability_type'] ) : 'post',
697
+ 'labeltext' => esc_html__( 'Capability Type', 'custom-post-type-ui' ),
698
+ 'helptext' => esc_html__( 'The post type to use for checking read, edit, and delete capabilities.', 'custom-post-type-ui' ),
699
+ ) );
700
+
701
+ $select = array(
702
+ 'options' => array(
703
+ array( 'attr' => '0', 'text' => esc_attr__( 'False', 'custom-post-type-ui' ), 'default' => 'true' ),
704
+ array( 'attr' => '1', 'text' => esc_attr__( 'True', 'custom-post-type-ui' ) ),
705
+ ),
706
+ );
707
+ $selected = ( isset( $current ) ) ? disp_boolean( $current['hierarchical'] ) : '';
708
+ $select['selected'] = ( ! empty( $selected ) ) ? $current['hierarchical'] : '';
709
+ echo $ui->get_select_input( array(
710
+ 'namearray' => 'cpt_custom_post_type',
711
+ 'name' => 'hierarchical',
712
+ 'labeltext' => esc_html__( 'Hierarchical', 'custom-post-type-ui' ),
713
+ 'aftertext' => esc_html__( '(default: false) Whether or not the post type can have parent-child relationships.', 'custom-post-type-ui' ),
714
+ 'selections' => $select,
715
+ ) );
716
+
717
+ $select = array(
718
+ 'options' => array(
719
+ array( 'attr' => '0', 'text' => esc_attr__( 'False', 'custom-post-type-ui' ) ),
720
+ array( 'attr' => '1', 'text' => esc_attr__( 'True', 'custom-post-type-ui' ), 'default' => 'true' ),
721
+ ),
722
+ );
723
+ $selected = ( isset( $current ) ) ? disp_boolean( $current['rewrite'] ) : '';
724
+ $select['selected'] = ( ! empty( $selected ) ) ? $current['rewrite'] : '';
725
+ echo $ui->get_select_input( array(
726
+ 'namearray' => 'cpt_custom_post_type',
727
+ 'name' => 'rewrite',
728
+ 'labeltext' => esc_html__( 'Rewrite', 'custom-post-type-ui' ),
729
+ 'aftertext' => esc_html__( '(default: true) Whether or not WordPress should use rewrites for this post type.', 'custom-post-type-ui' ),
730
+ 'selections' => $select,
731
+ ) );
732
+
733
+ echo $ui->get_text_input( array(
734
+ 'namearray' => 'cpt_custom_post_type',
735
+ 'name' => 'rewrite_slug',
736
+ 'textvalue' => ( isset( $current['rewrite_slug'] ) ) ? esc_attr( $current['rewrite_slug'] ) : '',
737
+ 'labeltext' => esc_html__( 'Custom Rewrite Slug', 'custom-post-type-ui' ),
738
+ 'aftertext' => esc_attr__( '(default: post type slug)', 'custom-post-type-ui' ),
739
+ 'helptext' => esc_html__( 'Custom post type slug to use instead of the default.', 'custom-post-type-ui' ),
740
+ ) );
741
+
742
+ $select = array(
743
+ 'options' => array(
744
+ array( 'attr' => '0', 'text' => esc_attr__( 'False', 'custom-post-type-ui' ) ),
745
+ array( 'attr' => '1', 'text' => esc_attr__( 'True', 'custom-post-type-ui' ), 'default' => 'true' ),
746
+ ),
747
+ );
748
+ $selected = ( isset( $current ) ) ? disp_boolean( $current['rewrite_withfront'] ) : '';
749
+ $select['selected'] = ( ! empty( $selected ) ) ? $current['rewrite_withfront'] : '';
750
+ echo $ui->get_select_input( array(
751
+ 'namearray' => 'cpt_custom_post_type',
752
+ 'name' => 'rewrite_withfront',
753
+ 'labeltext' => esc_html__( 'With Front', 'custom-post-type-ui' ),
754
+ 'aftertext' => esc_html__( '(default: true) Should the permastruct be prepended with the front base.', 'custom-post-type-ui' ),
755
+ 'selections' => $select,
756
+ ) );
757
+
758
+ $select = array(
759
+ 'options' => array(
760
+ array( 'attr' => '0', 'text' => esc_attr__( 'False', 'custom-post-type-ui' ) ),
761
+ array( 'attr' => '1', 'text' => esc_attr__( 'True', 'custom-post-type-ui' ), 'default' => 'true' ),
762
+ ),
763
+ );
764
+ $selected = ( isset( $current ) ) ? disp_boolean( $current['query_var'] ) : '';
765
+ $select['selected'] = ( ! empty( $selected ) ) ? $current['query_var'] : '';
766
+ echo $ui->get_select_input( array(
767
+ 'namearray' => 'cpt_custom_post_type',
768
+ 'name' => 'query_var',
769
+ 'labeltext' => esc_html__( 'Query Var', 'custom-post-type-ui' ),
770
+ 'aftertext' => esc_html__( '(default: true) Sets the query_var key for this post type.', 'custom-post-type-ui' ),
771
+ 'selections' => $select,
772
+ ) );
773
+
774
+ echo $ui->get_text_input( array(
775
+ 'namearray' => 'cpt_custom_post_type',
776
+ 'name' => 'query_var_slug',
777
+ 'textvalue' => ( isset( $current['query_var_slug'] ) ) ? esc_attr( $current['query_var_slug'] ) : '',
778
+ 'labeltext' => esc_html__( 'Custom Query Var Slug', 'custom-post-type-ui' ),
779
+ 'aftertext' => esc_attr__( '(default: post type slug) Query var needs to be true to use.', 'custom-post-type-ui' ),
780
+ 'helptext' => esc_html__( 'Custom query var slug to use instead of the default.', 'custom-post-type-ui' ),
781
+ ) );
782
+
783
+ echo $ui->get_tr_start() . $ui->get_th_start();
784
+ echo $ui->get_label( 'menu_position', esc_html__( 'Menu Position', 'custom-post-type-ui' ) );
785
+ echo $ui->get_p(
786
+ sprintf(
787
+ esc_html__(
788
+ 'See %s in the "menu_position" section. Range of 5-100',
789
+ 'custom-post-type-ui'
790
+ ),
791
+ sprintf(
792
+ '<a href="http://codex.wordpress.org/Function_Reference/register_post_type#Parameters" target="_blank">%s</a>',
793
+ esc_html__( 'Available options', 'custom-post-type-ui' )
794
+ )
795
+ )
796
+ );
797
+
798
+ echo $ui->get_th_end() . $ui->get_td_start();
799
+ echo $ui->get_text_input( array(
800
+ 'namearray' => 'cpt_custom_post_type',
801
+ 'name' => 'menu_position',
802
+ 'textvalue' => ( isset( $current['menu_position'] ) ) ? esc_attr( $current['menu_position'] ) : '',
803
+ 'helptext' => esc_html__( 'The position in the menu order the post type should appear. show_in_menu must be true.', 'custom-post-type-ui' ),
804
+ 'wrap' => false,
805
+ ) );
806
+ echo $ui->get_td_end() . $ui->get_tr_end();
807
+
808
+ echo $ui->get_tr_start() . $ui->get_th_start();
809
+ echo $ui->get_label( 'show_in_menu', esc_html__( 'Show in Menu', 'custom-post-type-ui' ) );
810
+ echo $ui->get_p( esc_html__( '"Show UI" must be "true". If an existing top level page such as "tools.php" is indicated for second input, post type will be sub menu of that.', 'custom-post-type-ui' ) );
811
+ echo $ui->get_th_end() . $ui->get_td_start();
812
+
813
+ $select = array(
814
+ 'options' => array(
815
+ array( 'attr' => '0', 'text' => esc_attr__( 'False', 'custom-post-type-ui' ) ),
816
+ array( 'attr' => '1', 'text' => esc_attr__( 'True', 'custom-post-type-ui' ), 'default' => 'true' ),
817
+ ),
818
+ );
819
+ $selected = ( isset( $current ) ) ? disp_boolean( $current['show_in_menu'] ) : '';
820
+ $select['selected'] = ( ! empty( $selected ) ) ? $current['show_in_menu'] : '';
821
+ echo $ui->get_select_input( array(
822
+ 'namearray' => 'cpt_custom_post_type',
823
+ 'name' => 'show_in_menu',
824
+ 'aftertext' => esc_html__( '(default: true) Whether or not to show the post type in the admin menu and where to show that menu.', 'custom-post-type-ui' ),
825
+ 'selections' => $select,
826
+ 'wrap' => false,
827
+ ) );
828
+
829
+ echo '<br/>';
830
+
831
+ echo $ui->get_text_input( array(
832
+ 'namearray' => 'cpt_custom_post_type',
833
+ 'name' => 'show_in_menu_string',
834
+ 'textvalue' => ( isset( $current['show_in_menu_string'] ) ) ? esc_attr( $current['show_in_menu_string'] ) : '',
835
+ 'helptext' => esc_attr__( 'The top-level admin menu page file name for which the post type should be in the sub menu of.', 'custom-post-type-ui' ),
836
+ 'helptext_after' => true,
837
+ 'wrap' => false,
838
+ ) );
839
+ echo $ui->get_td_end() . $ui->get_tr_end();
840
+
841
+ echo $ui->get_tr_start() . $ui->get_th_start() . '<label for="menu_icon">' . __( 'Menu Icon', 'custom-post-type-ui' ) . '</label>' . $ui->get_th_end() . $ui->get_td_start();
842
+ echo $ui->get_text_input( array(
843
+ 'namearray' => 'cpt_custom_post_type',
844
+ 'name' => 'menu_icon',
845
+ 'textvalue' => ( isset( $current['menu_icon'] ) ) ? esc_attr( $current['menu_icon'] ) : '',
846
+ 'aftertext' => esc_attr__( '(Full URL for icon or Dashicon class)', 'custom-post-type-ui' ),
847
+ 'helptext' => esc_html__( 'Image URL or Dashicon class name to use for icon. Custom image should be 20px by 20px.', 'custom-post-type-ui' ),
848
+ 'wrap' => false,
849
+ ) );
850
+
851
+ echo '<div class="cptui-spacer">';
852
+
853
+ echo $ui->get_button( array(
854
+ 'id' => 'cptui_choose_icon',
855
+ 'textvalue' => esc_attr__( 'Choose image icon', 'custom-post-type-ui' ),
856
+ ) );
857
+ echo '</div>';
858
+
859
+ echo $ui->get_td_end() . $ui->get_tr_end();
860
+
861
+ echo $ui->get_tr_start() . $ui->get_th_start() . esc_html__( 'Supports', 'custom-post-type-ui' );
862
+
863
+ echo $ui->get_p( esc_html__( 'Add support for various available post editor features on the right.', 'custom_post_type_ui' ) );
864
+
865
+ echo $ui->get_p( esc_html__( 'Use the "None" option to explicitly set "supports" to false.', 'custom-post-type-ui' ) );
866
+
867
+ echo $ui->get_th_end() . $ui->get_td_start() . $ui->get_fieldset_start();
868
+
869
+ $title_checked = ( ! empty( $current['supports'] ) && is_array( $current['supports'] ) && in_array( 'title', $current['supports'] ) ) ? 'true' : 'false';
870
+ if ( 'new' == $tab ) {
871
+ $title_checked = 'true';
872
+ }
873
+ echo $ui->get_check_input( array(
874
+ 'checkvalue' => 'title',
875
+ 'checked' => $title_checked,
876
+ 'name' => 'title',
877
+ 'namearray' => 'cpt_supports',
878
+ 'textvalue' => 'title',
879
+ 'labeltext' => esc_html__( 'Title', 'custom-post-type-ui' ),
880
+ 'default' => true,
881
+ 'wrap' => false,
882
+ ) );
883
+
884
+ $editor_checked = ( ! empty( $current['supports'] ) && is_array( $current['supports'] ) && in_array( 'editor', $current['supports'] ) ) ? 'true' : 'false';
885
+ if ( 'new' == $tab ) {
886
+ $editor_checked = 'true';
887
+ }
888
+ echo $ui->get_check_input( array(
889
+ 'checkvalue' => 'editor',
890
+ 'checked' => $editor_checked,
891
+ 'name' => 'editor',
892
+ 'namearray' => 'cpt_supports',
893
+ 'textvalue' => 'editor',
894
+ 'labeltext' => esc_html__( 'Editor', 'custom-post-type-ui' ),
895
+ 'default' => true,
896
+ 'wrap' => false,
897
+ ) );
898
+
899
+ $thumb_checked = ( ! empty( $current['supports'] ) && is_array( $current['supports'] ) && in_array( 'thumbnail', $current['supports'] ) ) ? 'true' : 'false';
900
+ if ( 'new' == $tab ) {
901
+ $thumb_checked = 'true';
902
+ }
903
+ echo $ui->get_check_input( array(
904
+ 'checkvalue' => 'thumbnail',
905
+ 'checked' => $thumb_checked,
906
+ 'name' => 'thumbnail',
907
+ 'namearray' => 'cpt_supports',
908
+ 'textvalue' => 'thumbnail',
909
+ 'labeltext' => esc_html__( 'Featured Image', 'custom-post-type-ui' ),
910
+ 'default' => true,
911
+ 'wrap' => false,
912
+ ) );
913
+
914
+ echo $ui->get_check_input( array(
915
+ 'checkvalue' => 'excerpt',
916
+ 'checked' => ( ! empty( $current['supports'] ) && is_array( $current['supports'] ) && in_array( 'excerpt', $current['supports'] ) ) ? 'true' : 'false',
917
+ 'name' => 'excerpts',
918
+ 'namearray' => 'cpt_supports',
919
+ 'textvalue' => 'excerpt',
920
+ 'labeltext' => esc_html__( 'Excerpt', 'custom-post-type-ui' ),
921
+ 'default' => true,
922
+ 'wrap' => false,
923
+ ) );
924
+
925
+ echo $ui->get_check_input( array(
926
+ 'checkvalue' => 'trackbacks',
927
+ 'checked' => ( ! empty( $current['supports'] ) && is_array( $current['supports'] ) && in_array( 'trackbacks', $current['supports'] ) ) ? 'true' : 'false',
928
+ 'name' => 'trackbacks',
929
+ 'namearray' => 'cpt_supports',
930
+ 'textvalue' => 'trackbacks',
931
+ 'labeltext' => esc_html__( 'Trackbacks', 'custom-post-type-ui' ),
932
+ 'default' => true,
933
+ 'wrap' => false,
934
+ ) );
935
+
936
+ echo $ui->get_check_input( array(
937
+ 'checkvalue' => 'custom-fields',
938
+ 'checked' => ( ! empty( $current['supports'] ) && is_array( $current['supports'] ) && in_array( 'custom-fields', $current['supports'] ) ) ? 'true' : 'false',
939
+ 'name' => 'custom-fields',
940
+ 'namearray' => 'cpt_supports',
941
+ 'textvalue' => 'custom-fields',
942
+ 'labeltext' => esc_html__( 'Custom Fields', 'custom-post-type-ui' ),
943
+ 'default' => true,
944
+ 'wrap' => false,
945
+ ) );
946
+
947
+ echo $ui->get_check_input( array(
948
+ 'checkvalue' => 'comments',
949
+ 'checked' => ( ! empty( $current['supports'] ) && is_array( $current['supports'] ) && in_array( 'comments', $current['supports'] ) ) ? 'true' : 'false',
950
+ 'name' => 'comments',
951
+ 'namearray' => 'cpt_supports',
952
+ 'textvalue' => 'comments',
953
+ 'labeltext' => esc_html__( 'Comments', 'custom-post-type-ui' ),
954
+ 'default' => true,
955
+ 'wrap' => false,
956
+ ) );
957
+
958
+ echo $ui->get_check_input( array(
959
+ 'checkvalue' => 'revisions',
960
+ 'checked' => ( ! empty( $current['supports'] ) && is_array( $current['supports'] ) && in_array( 'revisions', $current['supports'] ) ) ? 'true' : 'false',
961
+ 'name' => 'revisions',
962
+ 'namearray' => 'cpt_supports',
963
+ 'textvalue' => 'revisions',
964
+ 'labeltext' => esc_html__( 'Revisions', 'custom-post-type-ui' ),
965
+ 'default' => true,
966
+ 'wrap' => false,
967
+ ) );
968
+
969
+ echo $ui->get_check_input( array(
970
+ 'checkvalue' => 'author',
971
+ 'checked' => ( ! empty( $current['supports'] ) && is_array( $current['supports'] ) && in_array( 'author', $current['supports'] ) ) ? 'true' : 'false',
972
+ 'name' => 'author',
973
+ 'namearray' => 'cpt_supports',
974
+ 'textvalue' => 'author',
975
+ 'labeltext' => esc_html__( 'Author', 'custom-post-type-ui' ),
976
+ 'default' => true,
977
+ 'wrap' => false,
978
+ ) );
979
+
980
+ echo $ui->get_check_input( array(
981
+ 'checkvalue' => 'page-attributes',
982
+ 'checked' => ( ! empty( $current['supports'] ) && is_array( $current['supports'] ) && in_array( 'page-attributes', $current['supports'] ) ) ? 'true' : 'false',
983
+ 'name' => 'page-attributes',
984
+ 'namearray' => 'cpt_supports',
985
+ 'textvalue' => 'page-attributes',
986
+ 'labeltext' => esc_html__( 'Page Attributes', 'custom-post-type-ui' ),
987
+ 'default' => true,
988
+ 'wrap' => false,
989
+ ) );
990
+
991
+ echo $ui->get_check_input( array(
992
+ 'checkvalue' => 'post-formats',
993
+ 'checked' => ( ! empty( $current['supports'] ) && is_array( $current['supports'] ) && in_array( 'post-formats', $current['supports'] ) ) ? 'true' : 'false',
994
+ 'name' => 'post-formats',
995
+ 'namearray' => 'cpt_supports',
996
+ 'textvalue' => 'post-formats',
997
+ 'labeltext' => esc_html__( 'Post Formats', 'custom-post-type-ui' ),
998
+ 'default' => true,
999
+ 'wrap' => false,
1000
+ ) );
1001
+
1002
+ echo $ui->get_check_input( array(
1003
+ 'checkvalue' => 'none',
1004
+ 'checked' => ( ! empty( $current['supports'] ) && ( is_array( $current['supports'] ) && in_array( 'none', $current['supports'] ) ) ) ? 'true' : 'false',
1005
+ 'name' => 'none',
1006
+ 'namearray' => 'cpt_supports',
1007
+ 'textvalue' => 'none',
1008
+ 'labeltext' => esc_html__( 'None', 'custom-post-type-ui' ),
1009
+ 'default' => false,
1010
+ 'wrap' => false,
1011
+ ) );
1012
+
1013
+ echo $ui->get_fieldset_end() . $ui->get_td_end() . $ui->get_tr_end();
1014
+
1015
+ echo $ui->get_tr_start() . $ui->get_th_start() . '<label for="custom_supports">' . esc_html__( 'Custom "Supports"', 'custom-post-type-ui' ) . '</label>';
1016
+ echo $ui->get_p( sprintf( esc_html__( 'Use this input to register custom "supports" values, separated by commas. Learn about this at %s', 'custom-post-type-ui' ), '<a href="http://docs.pluginize.com/article/28-third-party-support-upon-registration" target="_blank">' . esc_html__( 'Custom "Supports"', 'custom-post-type-ui' ) . '</a>' ) );
1017
+ echo $ui->get_th_end() . $ui->get_td_start();
1018
+ echo $ui->get_text_input( array(
1019
+ 'namearray' => 'cpt_custom_post_type',
1020
+ 'name' => 'custom_supports',
1021
+ 'textvalue' => ( isset( $current['custom_supports'] ) ) ? esc_attr( $current['custom_supports'] ) : '',
1022
+ 'helptext' => esc_attr__( 'Provide custom support slugs here.', 'custom-post-type-ui' ),
1023
+ 'helptext_after' => true,
1024
+ 'wrap' => false,
1025
+ ) );
1026
+ echo $ui->get_td_end() . $ui->get_tr_end();
1027
+
1028
+ echo $ui->get_tr_start() . $ui->get_th_start() . esc_html__( 'Built-in Taxonomies', 'custom-post-type-ui' );
1029
+
1030
+ echo $ui->get_p( esc_html__( 'Add support for available registered taxonomies.', 'custom-post-type-ui' ) );
1031
+
1032
+ echo $ui->get_th_end() . $ui->get_td_start() . $ui->get_fieldset_start();
1033
+
1034
+ /**
1035
+ * Filters the arguments for taxonomies to list for post type association.
1036
+ *
1037
+ * @since 1.0.0
1038
+ *
1039
+ * @param array $value Array of default arguments.
1040
+ */
1041
+ $args = apply_filters( 'cptui_attach_taxonomies_to_post_type', array( 'public' => true ) );
1042
+
1043
+ // If they don't return an array, fall back to the original default. Don't need to check for empty, because empty array is default for $args param in get_post_types anyway.
1044
+ if ( ! is_array( $args ) ) {
1045
+ $args = array( 'public' => true );
1046
+ }
1047
+
1048
+ $add_taxes = get_taxonomies( $args, 'objects' );
1049
+ unset( $add_taxes['nav_menu'] ); unset( $add_taxes['post_format'] );
1050
+ foreach ( $add_taxes as $add_tax ) {
1051
+
1052
+ $core_label = ( in_array( $add_tax->name, array( 'category', 'post_tag' ) ) ) ? __( '(WP Core)', 'custom-post-type-ui' ) : '';
1053
+ echo $ui->get_check_input( array(
1054
+ 'checkvalue' => $add_tax->name,
1055
+ 'checked' => ( ! empty( $current['taxonomies'] ) && is_array( $current['taxonomies'] ) && in_array( $add_tax->name, $current['taxonomies'] ) ) ? 'true' : 'false',
1056
+ 'name' => $add_tax->name,
1057
+ 'namearray' => 'cpt_addon_taxes',
1058
+ 'textvalue' => $add_tax->name,
1059
+ 'labeltext' => $add_tax->label . ' ' . $core_label,
1060
+ 'helptext' => sprintf( esc_attr__( 'Adds %s support', 'custom-post-type-ui' ), $add_tax->label ),
1061
+ 'wrap' => false,
1062
+ ) );
1063
+ }
1064
+ echo $ui->get_fieldset_end() . $ui->get_td_end() . $ui->get_tr_end();
1065
+ ?>
1066
+ </table>
1067
+ </div>
1068
+ </div>
1069
+ </div>
1070
+
1071
+ <?php
1072
+ /**
1073
+ * Fires after the default fieldsets on the post editor screen.
1074
+ *
1075
+ * @since 1.3.0
1076
+ *
1077
+ * @param cptui_admin_ui $ui Admin UI instance.
1078
+ */
1079
+ do_action( 'cptui_post_type_after_fieldsets', $ui ); ?>
1080
+
1081
+ <p>
1082
+ <?php
1083
+ if ( ! empty( $_GET ) && ! empty( $_GET['action'] ) && 'edit' == $_GET['action'] ) {
1084
  /**
1085
  * Filters the text value to use on the button when editing.
1086
  *
1101
  */
1102
  ?>
1103
  <input type="submit" class="button-secondary" name="cpt_delete" id="cpt_submit_delete" value="<?php echo esc_attr( apply_filters( 'cptui_post_type_submit_delete', __( 'Delete Post Type', 'custom-post-type-ui' ) ) ); ?>" />
1104
+ <?php
1105
+ } else {
1106
 
1107
  /**
1108
  * Filters the text value to use on the button when adding.
1113
  */
1114
  ?>
1115
  <input type="submit" class="button-primary" name="cpt_submit" value="<?php echo esc_attr( apply_filters( 'cptui_post_type_submit_add', __( 'Add Post Type', 'custom-post-type-ui' ) ) ); ?>" />
1116
+ <?php } ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1117
  </p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1118
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1119
  </form>
1120
  </div><!-- End .wrap -->
1121
  <?php
1127
  * @since 1.0.0
1128
  *
1129
  * @param array $post_types Array of post types that are registered.
 
 
1130
  */
1131
  function cptui_post_types_dropdown( $post_types = array() ) {
1132
 
1133
  $ui = new cptui_admin_ui();
1134
 
1135
+ if ( ! empty( $post_types ) ) {
1136
  $select = array();
1137
  $select['options'] = array();
1138
 
1139
+ foreach ( $post_types as $type ) {
1140
+ $text = ( ! empty( $type['label'] ) ) ? $type['label'] : $type['name'];
1141
  $select['options'][] = array( 'attr' => $type['name'], 'text' => $text );
1142
  }
1143
 
1148
  'namearray' => 'cptui_selected_post_type',
1149
  'name' => 'post_type',
1150
  'selections' => $select,
1151
+ 'wrap' => false,
1152
  ) );
1153
  }
1154
  }
1171
  if ( ! empty( $_POST ) ) {
1172
  if ( isset( $_POST['cptui_selected_post_type']['post_type'] ) ) {
1173
  $type = sanitize_text_field( $_POST['cptui_selected_post_type']['post_type'] );
1174
+ } else if ( $post_type_deleted ) {
 
 
1175
  $post_types = cptui_get_post_type_data();
1176
  $type = key( $post_types );
1177
+ } else if ( isset( $_POST['cpt_custom_post_type']['name'] ) ) {
 
 
1178
  $type = sanitize_text_field( $_POST['cpt_custom_post_type']['name'] );
1179
  }
1180
+ } else if ( ! empty( $_GET ) && isset( $_GET['cptui_post_type'] ) ) {
1181
  $type = sanitize_text_field( $_GET['cptui_post_type'] );
1182
  } else {
1183
  $post_types = cptui_get_post_type_data();
1184
+ if ( ! empty( $post_types ) ) {
1185
  // Will return the first array key.
1186
  $type = key( $post_types );
1187
  }
1204
  *
1205
  * @internal
1206
  *
1207
+ * @param array $data $_POST values.
1208
  *
1209
  * @return bool|string False on failure, string on success.
1210
  */
1214
  if ( is_string( $data ) && cptui_get_post_type_exists( $data, $data ) ) {
1215
  $data = array(
1216
  'cpt_custom_post_type' => array(
1217
+ 'name' => $data,
1218
+ ),
1219
  );
1220
  }
1221
 
1222
+ if ( empty( $data['cpt_custom_post_type']['name'] ) ) {
1223
  return cptui_admin_notices( 'error', '', false, __( 'Please provide a post type to delete', 'custom-post-type-ui' ) );
1224
  }
1225
 
1265
  set_transient( 'cptui_flush_rewrite_rules', 'true', 5 * 60 );
1266
 
1267
  if ( isset( $success ) ) {
1268
+ return 'delete_success';
1269
  }
1270
+ return 'delete_fail';
1271
  }
1272
 
1273
  /**
1297
  return cptui_admin_notices( 'error', '', false, __( 'Please provide a post type name', 'custom-post-type-ui' ) );
1298
  }
1299
 
1300
+ if ( ! empty( $data['cpt_original'] ) && $data['cpt_original'] != $data['cpt_custom_post_type']['name'] ) {
1301
+ if ( ! empty( $data['update_post_types'] ) ) {
1302
  cptui_convert_post_type_posts( $data['cpt_original'], $data['cpt_custom_post_type']['name'] );
1303
  }
1304
  }
1305
 
1306
+ // Clean up $_POST data.
1307
+ foreach ( $data as $key => $value ) {
1308
  if ( is_string( $value ) ) {
1309
  $data[ $key ] = sanitize_text_field( $value );
1310
  } else {
1318
  false !== strpos( $data['cpt_custom_post_type']['rewrite_slug'], '\'' ) ||
1319
  false !== strpos( $data['cpt_custom_post_type']['rewrite_slug'], '\"' ) ) {
1320
 
1321
+ add_filter( 'cptui_custom_error_message', 'cptui_slug_has_quotes' );
1322
+ return 'error';
1323
  }
1324
 
1325
  $post_types = cptui_get_post_type_data();
1337
  $slug_as_page = cptui_check_page_slugs( $data['cpt_custom_post_type']['name'] );
1338
  if ( 'new' == $data['cpt_type_status'] ) {
1339
  if ( true === $slug_exists ) {
1340
+ add_filter( 'cptui_custom_error_message', 'cptui_slug_matches_post_type' );
1341
+ return 'error';
1342
  }
1343
  if ( true === $slug_as_page ) {
1344
+ add_filter( 'cptui_custom_error_message', 'cptui_slug_matches_page' );
1345
+ return 'error';
1346
  }
1347
  }
1348
 
1349
+ if ( empty( $data['cpt_addon_taxes'] ) || ! is_array( $data['cpt_addon_taxes'] ) ) {
1350
  $data['cpt_addon_taxes'] = array();
1351
  }
1352
 
1353
+ if ( empty( $data['cpt_supports'] ) || ! is_array( $data['cpt_supports'] ) ) {
1354
  $data['cpt_supports'] = array();
1355
  }
1356
 
1357
+ foreach ( $data['cpt_labels'] as $key => $label ) {
1358
  if ( empty( $label ) ) {
1359
  unset( $data['cpt_labels'][ $key ] );
1360
  }
1362
  $label = str_replace( '"', '', htmlspecialchars_decode( $label ) );
1363
  $label = htmlspecialchars( $label, ENT_QUOTES );
1364
  $label = trim( $label );
1365
+ if ( 'parent' === $key ) {
1366
+ $data['cpt_labels']['parent_item_colon'] = stripslashes_deep( $label );
1367
+ } else {
1368
+ $data['cpt_labels'][ $key ] = stripslashes_deep( $label );
1369
+ }
1370
  }
1371
 
1372
  if ( empty( $data['cpt_custom_post_type']['menu_icon'] ) ) {
1403
  'singular_label' => $singular_label,
1404
  'description' => $description,
1405
  'public' => disp_boolean( $data['cpt_custom_post_type']['public'] ),
1406
+ 'publicly_queryable' => disp_boolean( $data['cpt_custom_post_type']['publicly_queryable'] ),
1407
  'show_ui' => disp_boolean( $data['cpt_custom_post_type']['show_ui'] ),
1408
  'show_in_nav_menus' => disp_boolean( $data['cpt_custom_post_type']['show_in_nav_menus'] ),
1409
  'show_in_rest' => disp_boolean( $data['cpt_custom_post_type']['show_in_rest'] ),
1455
 
1456
  if ( isset( $success ) ) {
1457
  if ( 'new' == $data['cpt_type_status'] ) {
1458
+ return 'add_success';
1459
  }
1460
  }
1461
+ return 'update_success';
1462
  }
1463
 
1464
  /**
1520
  );
1521
  $convert = new WP_Query( $args );
1522
 
1523
+ if ( $convert->have_posts() ) :
1524
+ while ( $convert->have_posts() ) :
1525
+ $convert->the_post();
1526
+ set_post_type( get_the_ID(), $new_slug );
1527
+ endwhile;
1528
+ endif;
1529
 
1530
  cptui_delete_post_type( $original_slug );
1531
  }
1590
 
1591
  return false;
1592
  }
1593
+
1594
+ /**
1595
+ * Handle the save and deletion of post type data.
1596
+ *
1597
+ * @since 1.4.0
1598
+ */
1599
+ function cptui_process_post_type() {
1600
+
1601
+ if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
1602
+ return;
1603
+ }
1604
+
1605
+ if ( ! is_admin() ) {
1606
+ return;
1607
+ }
1608
+
1609
+ if ( ! empty( $_GET ) && isset( $_GET['page'] ) && 'cptui_manage_post_types' !== $_GET['page'] ) {
1610
+ return;
1611
+ }
1612
+
1613
+ if ( ! empty( $_POST ) ) {
1614
+ $result = '';
1615
+ if ( isset( $_POST['cpt_submit'] ) ) {
1616
+ check_admin_referer( 'cptui_addedit_post_type_nonce_action', 'cptui_addedit_post_type_nonce_field' );
1617
+ $result = cptui_update_post_type( $_POST );
1618
+ } elseif ( isset( $_POST['cpt_delete'] ) ) {
1619
+ check_admin_referer( 'cptui_addedit_post_type_nonce_action', 'cptui_addedit_post_type_nonce_field' );
1620
+ $result = cptui_delete_post_type( $_POST );
1621
+ add_filter( 'cptui_post_type_deleted', '__return_true' );
1622
+ }
1623
+
1624
+ if ( $result ) {
1625
+ add_action( 'admin_notices', "cptui_{$result}_admin_notice" );
1626
+ }
1627
+ }
1628
+ }
1629
+ add_action( 'init', 'cptui_process_post_type', 8 );
inc/support.php CHANGED
@@ -44,7 +44,7 @@ add_action( 'admin_enqueue_scripts', 'cptui_support_enqueue_scripts' );
44
  * @internal
45
  */
46
  function cptui_support() {
47
- echo '<div class="wrap">';
48
 
49
  /**
50
  * Fires at the top of the FAQ/Support page.
@@ -89,7 +89,7 @@ function cptui_support() {
89
  printf(
90
  esc_html__( 'You can have them automatically removed from display via a purchased copy of %s.', 'custom-post-type-ui' ),
91
  sprintf( '<a href="%s">%s</a>',
92
- 'https://pluginize.com/product/custom-post-type-ui-extended/?utm_source=faq&utm_medium=text&utm_campaign=cptui',
93
  'Custom Post Type UI Extended'
94
  )
95
  ); ?>
44
  * @internal
45
  */
46
  function cptui_support() {
47
+ echo '<div class="wrap cptui-support">';
48
 
49
  /**
50
  * Fires at the top of the FAQ/Support page.
89
  printf(
90
  esc_html__( 'You can have them automatically removed from display via a purchased copy of %s.', 'custom-post-type-ui' ),
91
  sprintf( '<a href="%s">%s</a>',
92
+ 'https://pluginize.com/product/custom-post-type-ui-extended/?utm_source=faq-remove&utm_medium=text&utm_campaign=cptui',
93
  'Custom Post Type UI Extended'
94
  )
95
  ); ?>
inc/taxonomies.php CHANGED
@@ -22,9 +22,9 @@ if ( ! defined( 'ABSPATH' ) ) {
22
  */
23
  function cptui_taxonomies_enqueue_scripts() {
24
 
25
- $currentScreen = get_current_screen();
26
 
27
- if ( ! is_object( $currentScreen ) || 'cpt-ui_page_cptui_manage_taxonomies' !== $currentScreen->base ) {
28
  return;
29
  }
30
 
@@ -35,7 +35,8 @@ function cptui_taxonomies_enqueue_scripts() {
35
  wp_enqueue_script( 'cptui' );
36
  wp_localize_script( 'cptui', 'cptui_tax_data',
37
  array(
38
- 'confirm' => __( 'Are you sure you want to delete this? Deleting will NOT remove created content.', 'custom-post-type-ui' ),
 
39
  )
40
  );
41
  }
@@ -54,18 +55,18 @@ add_action( 'admin_enqueue_scripts', 'cptui_taxonomies_enqueue_scripts' );
54
  */
55
  function cptui_taxonomy_tabs( $tabs = array(), $current_page = '' ) {
56
 
57
- if ( 'taxonomies' == $current_page ) {
58
  $taxonomies = cptui_get_taxonomy_data();
59
  $classes = array( 'nav-tab' );
60
 
61
- $tabs['page_title'] = __( 'Manage Taxonomies', 'custom-post-type-ui' );
62
  $tabs['tabs'] = array();
63
  // Start out with our basic "Add new" tab.
64
  $tabs['tabs']['add'] = array(
65
- 'text' => __( 'Add New Taxonomy', 'custom-post-type-ui' ),
66
  'classes' => $classes,
67
  'url' => cptui_admin_url( 'admin.php?page=cptui_manage_' . $current_page ),
68
- 'aria-selected' => 'false'
69
  );
70
 
71
  $action = cptui_get_current_action();
@@ -80,17 +81,24 @@ function cptui_taxonomy_tabs( $tabs = array(), $current_page = '' ) {
80
  $classes[] = 'nav-tab-active';
81
  }
82
  $tabs['tabs']['edit'] = array(
83
- 'text' => __( 'Edit Taxonomies', 'custom-post-type-ui' ),
84
  'classes' => $classes,
85
  'url' => esc_url( add_query_arg( array( 'action' => 'edit' ), cptui_admin_url( 'admin.php?page=cptui_manage_' . $current_page ) ) ),
86
- 'aria-selected' => ( ! empty( $action ) ) ? 'true' : 'false'
87
  );
88
 
89
  $tabs['tabs']['view'] = array(
90
- 'text' => __( 'View Taxonomies', 'custom-post-type-ui' ),
91
  'classes' => array( 'nav-tab' ), // Prevent notices.
92
  'url' => esc_url( cptui_admin_url( 'admin.php?page=cptui_listings#taxonomies' ) ),
93
- 'aria-selected' => 'false'
 
 
 
 
 
 
 
94
  );
95
  }
96
  }
@@ -109,20 +117,7 @@ add_filter( 'cptui_get_tabs', 'cptui_taxonomy_tabs', 10, 2 );
109
  */
110
  function cptui_manage_taxonomies() {
111
 
112
- $taxonomy_deleted = false;
113
-
114
- if ( !empty( $_POST ) ) {
115
- if ( isset( $_POST['cpt_submit'] ) ) {
116
- check_admin_referer( 'cptui_addedit_taxonomy_nonce_action', 'cptui_addedit_taxonomy_nonce_field' );
117
- $notice = cptui_update_taxonomy( $_POST );
118
- } elseif ( isset( $_POST['cpt_delete'] ) ) {
119
- check_admin_referer( 'cptui_addedit_taxonomy_nonce_action', 'cptui_addedit_taxonomy_nonce_field' );
120
- $notice = cptui_delete_taxonomy( $_POST );
121
- $taxonomy_deleted = true;
122
- }
123
- }
124
-
125
- $tab = ( !empty( $_GET ) && !empty( $_GET['action'] ) && 'edit' == $_GET['action'] ) ? 'edit' : 'new';
126
  $tab_class = 'cptui-' . $tab; ?>
127
 
128
  <div class="wrap <?php echo esc_attr( $tab_class ); ?>">
@@ -135,9 +130,14 @@ function cptui_manage_taxonomies() {
135
  */
136
  do_action( 'cptui_inside_taxonomy_wrap' );
137
 
138
- if ( isset( $notice ) ) {
139
- echo $notice;
140
- }
 
 
 
 
 
141
 
142
  // Create our tabs.
143
  cptui_settings_tab_menu( $page = 'taxonomies' );
@@ -165,9 +165,9 @@ function cptui_manage_taxonomies() {
165
  $ui = new cptui_admin_ui();
166
 
167
  // Will only be set if we're already on the edit screen.
168
- if ( !empty( $taxonomies ) ) { ?>
169
  <form id="cptui_select_taxonomy" method="post" action="<?php echo esc_url( cptui_get_post_form_action( $ui ) ); ?>">
170
- <label for="taxonomy"><?php _e( 'Select: ', 'custom-post-type-ui' ); ?></label>
171
  <?php
172
  cptui_taxonomies_dropdown( $taxonomies );
173
 
@@ -179,139 +179,684 @@ function cptui_manage_taxonomies() {
179
  * @param string $value Text to use for the button.
180
  */
181
  ?>
182
- <input type="submit" class="button-secondary" name="cptui_select_taxonomy_submit" value="<?php echo esc_attr( apply_filters( 'cptui_taxonomy_submit_select', __( 'Select', 'custom-post-type-ui' ) ) ); ?>" />
183
  </form>
184
  <?php
185
 
186
- /**
187
- * Fires below the taxonomy select input.
188
- *
189
- * @since 1.1.0
190
- *
191
- * @param string $value Current taxonomy selected.
192
- */
193
- do_action( 'cptui_below_taxonomy_select', $current['name'] );
194
  } ?>
195
 
196
  <form class="taxonomiesui" method="post" action="<?php echo esc_url( cptui_get_post_form_action( $ui ) ); ?>">
197
- <div class="cptui-section">
198
- <?php echo $ui->get_fieldset_start();
199
- echo $ui->get_legend_start();
200
- esc_html_e( 'Basic settings', 'custom-post-type-ui' );
201
- echo $ui->get_legend_end();
202
- ?>
203
- <table class="form-table cptui-table">
204
- <?php
205
- echo $ui->get_tr_start() . $ui->get_th_start();
206
- echo $ui->get_label( 'name', __( 'Taxonomy Slug', 'custom-post-type-ui' ) ) . $ui->get_required_span();
207
- echo $ui->get_th_end() . $ui->get_td_start();
208
-
209
- echo $ui->get_text_input( array(
210
- 'namearray' => 'cpt_custom_tax',
211
- 'name' => 'name',
212
- 'textvalue' => ( isset( $current['name'] ) ) ? esc_attr( $current['name'] ) : '',
213
- 'maxlength' => '32',
214
- 'helptext' => esc_attr__( 'The taxonomy name/slug. Used for various queries for taxonomy content.', 'custom-post-type-ui'),
215
- 'required' => true,
216
- 'placeholder' => false,
217
- 'wrap' => false,
218
- ) );
219
-
220
- echo '<p class="cptui-slug-details">';
221
- esc_html_e( 'Slugs should only contain alphanumeric, latin characters. Underscores or dashes should be used in place of spaces.', 'custom-post-type-ui' );
222
- echo '</p>';
223
-
224
- if ( 'edit' == $tab ) {
225
- echo '<p>';
226
- esc_html_e( 'DO NOT EDIT the taxonomy slug unless also planning to migrate terms. Changing the slug registers a new taxonomy entry.', 'custom-post-type-ui' );
227
- echo '</p>';
228
-
229
- echo '<div class="cptui-spacer">';
230
- echo $ui->get_check_input( array(
231
- 'checkvalue' => 'update_taxonomy',
232
- 'checked' => 'false',
233
- 'name' => 'update_taxonomy',
234
- 'namearray' => 'update_taxonomy',
235
- 'labeltext' => __( 'Migrate terms to newly renamed taxonomy?', 'custom-post-type-ui' ),
236
- 'helptext' => '',
237
- 'default' => false,
238
- 'wrap' => false,
239
- ) );
240
- echo '</div>';
241
- }
242
-
243
- echo $ui->get_td_end() . $ui->get_tr_end();
244
-
245
- echo $ui->get_tr_start() . $ui->get_th_start() . __( 'Attach to Post Type', 'custom-post-type-ui' ) . $ui->get_required_span();
246
- echo $ui->get_th_end() . $ui->get_td_start() . $ui->get_fieldset_start();
247
-
248
- /**
249
- * Filters the arguments for post types to list for taxonomy association.
250
- *
251
- * @since 1.0.0
252
- *
253
- * @param array $value Array of default arguments.
254
- */
255
- $args = apply_filters( 'cptui_attach_post_types_to_taxonomy', array( 'public' => true ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
256
 
257
- // If they don't return an array, fall back to the original default. Don't need to check for empty, because empty array is default for $args param in get_post_types anyway.
258
- if ( ! is_array( $args ) ) {
259
- $args = array( 'public' => true );
260
- }
261
- $output = 'objects'; // Or objects.
 
 
 
 
262
 
263
- /**
264
- * Filters the results returned to display for available post types for taxonomy.
265
- *
266
- * @since 1.3.0
267
- *
268
- * @param array $value Array of post type objects.
269
- * @param array $args Array of arguments for the post type query.
270
- * @param string $output The output type we want for the results.
271
- */
272
- $post_types = apply_filters( 'cptui_get_post_types_for_taxonomies', get_post_types( $args, $output ), $args, $output );
273
-
274
- foreach ( $post_types as $post_type ) {
275
- $core_label = ( in_array( $post_type->name, array(
276
- 'post',
277
- 'page',
278
- 'attachment',
279
- ) ) ) ? __( '(WP Core)', 'custom-post-type-ui' ) : '';
280
- echo $ui->get_check_input( array(
281
- 'checkvalue' => $post_type->name,
282
- 'checked' => ( ! empty( $current['object_types'] ) && is_array( $current['object_types'] ) && in_array( $post_type->name, $current['object_types'] ) ) ? 'true' : 'false',
283
- 'name' => $post_type->name,
284
- 'namearray' => 'cpt_post_types',
285
- 'textvalue' => $post_type->name,
286
- 'labeltext' => $post_type->label . ' ' . $core_label,
287
- 'helptext' => sprintf( esc_attr__( 'Adds %s support', 'custom-post-type-ui' ), $post_type->label ),
288
- 'wrap' => false
289
- ) );
290
- }
291
-
292
- echo $ui->get_fieldset_end() . $ui->get_td_end() . $ui->get_tr_end();
293
-
294
- echo $ui->get_text_input( array(
295
- 'namearray' => 'cpt_custom_tax',
296
- 'name' => 'label',
297
- 'textvalue' => ( isset( $current['label'] ) ) ? esc_attr( $current['label'] ) : '',
298
- 'aftertext' => __( '(e.g. Actors)', 'custom-post-type-ui' ),
299
- 'labeltext' => __( 'Plural Label', 'custom-post-type-ui' ),
300
- 'helptext' => esc_attr__( 'Used for the taxonomy admin menu item.', 'custom-post-type-ui' ),
301
- 'required' => true
302
- ) );
303
-
304
- echo $ui->get_text_input( array(
305
- 'namearray' => 'cpt_custom_tax',
306
- 'name' => 'singular_label',
307
- 'textvalue' => ( isset( $current['singular_label'] ) ) ? esc_attr( $current['singular_label'] ) : '',
308
- 'aftertext' => __( '(e.g. Actor)', 'custom-post-type-ui' ),
309
- 'labeltext' => __( 'Singular Label', 'custom-post-type-ui' ),
310
- 'helptext' => esc_attr__( 'Used when a singular label is needed.', 'custom-post-type-ui' ),
311
- 'required' => true
312
- ) );
313
- ?>
314
- </table>
315
  <p class="submit">
316
  <?php wp_nonce_field( 'cptui_addedit_taxonomy_nonce_action', 'cptui_addedit_taxonomy_nonce_field' );
317
  if ( ! empty( $_GET ) && ! empty( $_GET['action'] ) && 'edit' == $_GET['action'] ) { ?>
@@ -325,7 +870,7 @@ function cptui_manage_taxonomies() {
325
  * @param string $value Text to use for the button.
326
  */
327
  ?>
328
- <input type="submit" class="button-primary" name="cpt_submit" value="<?php echo esc_attr( apply_filters( 'cptui_taxonomy_submit_edit', __( 'Save Taxonomy', 'custom-post-type-ui' ) ) ); ?>" />
329
  <?php
330
 
331
  /**
@@ -336,7 +881,7 @@ function cptui_manage_taxonomies() {
336
  * @param string $value Text to use for the button.
337
  */
338
  ?>
339
- <input type="submit" class="button-secondary" name="cpt_delete" id="cpt_submit_delete" value="<?php echo apply_filters( 'cptui_taxonomy_submit_delete', __( 'Delete Taxonomy', 'custom-post-type-ui' ) ); ?>" />
340
  <?php } else { ?>
341
  <?php
342
 
@@ -348,481 +893,18 @@ function cptui_manage_taxonomies() {
348
  * @param string $value Text to use for the button.
349
  */
350
  ?>
351
- <input type="submit" class="button-primary" name="cpt_submit" value="<?php echo esc_attr( apply_filters( 'cptui_taxonomy_submit_add', __( 'Add Taxonomy', 'custom-post-type-ui' ) ) ); ?>" />
352
  <?php } ?>
353
 
354
  <?php if ( ! empty( $current ) ) { ?>
355
  <input type="hidden" name="tax_original" id="tax_original" value="<?php echo $current['name']; ?>" />
356
  <?php }
357
 
358
- // Used to check and see if we should prevent duplicate slugs ?>
359
  <input type="hidden" name="cpt_tax_status" id="cpt_tax_status" value="<?php echo $tab; ?>" />
360
  </p>
361
- <?php
362
- echo $ui->get_fieldset_end(); ?>
363
- </div>
364
- <div class="cptui-section">
365
- <p>
366
- <a href="#" id="togglelabels" class="button-secondary"><?php esc_html_e( 'Edit additional labels', 'custom-post-type-ui' ); ?></a>
367
- </p>
368
- <?php
369
- $fieldset_classes = ( 'edit' == $tab ) ? '' : 'toggledclosed';
370
- echo $ui->get_fieldset_start( array( 'id' => 'labels_expand', 'classes' => array( $fieldset_classes ) ) );
371
- echo $ui->get_legend_start();
372
- esc_html_e( 'Additional labels', 'custom-post-type-ui' );
373
- echo $ui->get_legend_end();
374
- ?>
375
- <table class="form-table cptui-table">
376
-
377
- <?php
378
- if ( isset( $current['description'] ) ) {
379
- $current['description'] = stripslashes_deep( $current['description'] );
380
- }
381
- echo $ui->get_textarea_input( array(
382
- 'namearray' => 'cpt_custom_tax',
383
- 'name' => 'description',
384
- 'rows' => '4',
385
- 'cols' => '40',
386
- 'textvalue' => ( isset( $current['description'] ) ) ? esc_textarea( $current['description'] ) : '',
387
- 'labeltext' => __( 'Description', 'custom-post-type-ui' ),
388
- 'helptext' => esc_attr__( 'Describe what your taxonomy is used for.', 'custom-post-type-ui' )
389
- ) );
390
-
391
- echo $ui->get_text_input( array(
392
- 'namearray' => 'cpt_tax_labels',
393
- 'name' => 'menu_name',
394
- 'textvalue' => ( isset( $current['labels']['menu_name'] ) ) ? esc_attr( $current['labels']['menu_name'] ) : '',
395
- 'aftertext' => __( '(e.g. Actors)', 'custom-post-type-ui' ),
396
- 'labeltext' => __( 'Menu Name', 'custom-post-type-ui' ),
397
- 'helptext' => esc_attr__( 'Custom admin menu name for your taxonomy.', 'custom-post-type-ui'),
398
- ) );
399
-
400
- echo $ui->get_text_input( array(
401
- 'namearray' => 'cpt_tax_labels',
402
- 'name' => 'all_items',
403
- 'textvalue' => ( isset( $current['labels']['all_items'] ) ) ? esc_attr( $current['labels']['all_items'] ) : '',
404
- 'aftertext' => __( '(e.g. All Actors)', 'custom-post-type-ui' ),
405
- 'labeltext' => __( 'All Items', 'custom-post-type-ui' ),
406
- 'helptext' => esc_attr__( 'Used as tab text when showing all terms for hierarchical taxonomy while editing post.', 'custom-post-type-ui'),
407
- ) );
408
-
409
- echo $ui->get_text_input( array(
410
- 'namearray' => 'cpt_tax_labels',
411
- 'name' => 'edit_item',
412
- 'textvalue' => ( isset( $current['labels']['edit_item'] ) ) ? esc_attr( $current['labels']['edit_item'] ) : '',
413
- 'aftertext' => __( '(e.g. Edit Actor)', 'custom-post-type-ui' ),
414
- 'labeltext' => __( 'Edit Item', 'custom-post-type-ui' ),
415
- 'helptext' => esc_attr__( 'Used at the top of the term editor screen for an existing taxonomy term.', 'custom-post-type-ui'),
416
- ) );
417
-
418
- echo $ui->get_text_input( array(
419
- 'namearray' => 'cpt_tax_labels',
420
- 'name' => 'view_item',
421
- 'textvalue' => ( isset( $current['labels']['view_item'] ) ) ? esc_attr( $current['labels']['view_item'] ) : '',
422
- 'aftertext' => __( '(e.g. View Actor)', 'custom-post-type-ui' ),
423
- 'labeltext' => __( 'View Item', 'custom-post-type-ui' ),
424
- 'helptext' => esc_attr__( 'Used in the admin bar when viewing editor screen for an existing taxonomy term.', 'custom-post-type-ui'),
425
- ) );
426
-
427
- echo $ui->get_text_input( array(
428
- 'namearray' => 'cpt_tax_labels',
429
- 'name' => 'update_item',
430
- 'textvalue' => ( isset( $current['labels']['update_item'] ) ) ? esc_attr( $current['labels']['update_item'] ) : '',
431
- 'aftertext' => __( '(e.g. Update Actor Name)', 'custom-post-type-ui' ),
432
- 'labeltext' => __( 'Update Item Name', 'custom-post-type-ui' ),
433
- 'helptext' => esc_attr__( 'Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'custom-post-type-ui'),
434
- ) );
435
-
436
- echo $ui->get_text_input( array(
437
- 'namearray' => 'cpt_tax_labels',
438
- 'name' => 'add_new_item',
439
- 'textvalue' => ( isset( $current['labels']['add_new_item'] ) ) ? esc_attr( $current['labels']['add_new_item'] ) : '',
440
- 'aftertext' => __( '(e.g. Add New Actor)', 'custom-post-type-ui' ),
441
- 'labeltext' => __( 'Add New Item', 'custom-post-type-ui' ),
442
- 'helptext' => esc_attr__( 'Used at the top of the term editor screen and button text for a new taxonomy term.', 'custom-post-type-ui'),
443
- ) );
444
-
445
- echo $ui->get_text_input( array(
446
- 'namearray' => 'cpt_tax_labels',
447
- 'name' => 'new_item_name',
448
- 'textvalue' => ( isset( $current['labels']['new_item_name'] ) ) ? esc_attr( $current['labels']['new_item_name'] ) : '',
449
- 'aftertext' => __( '(e.g. New Actor Name)', 'custom-post-type-ui' ),
450
- 'labeltext' => __( 'New Item Name', 'custom-post-type-ui' ),
451
- 'helptext' => esc_attr__( 'Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'custom-post-type-ui'),
452
- ) );
453
-
454
- echo $ui->get_text_input( array(
455
- 'namearray' => 'cpt_tax_labels',
456
- 'name' => 'parent_item',
457
- 'textvalue' => ( isset( $current['labels']['parent_item'] ) ) ? esc_attr( $current['labels']['parent_item'] ) : '',
458
- 'aftertext' => __( '(e.g. Parent Actor)', 'custom-post-type-ui' ),
459
- 'labeltext' => __( 'Parent Item', 'custom-post-type-ui' ),
460
- 'helptext' => esc_attr__( 'Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'custom-post-type-ui'),
461
- ) );
462
-
463
- echo $ui->get_text_input( array(
464
- 'namearray' => 'cpt_tax_labels',
465
- 'name' => 'parent_item_colon',
466
- 'textvalue' => ( isset( $current['labels']['parent_item_colon'] ) ) ? esc_attr( $current['labels']['parent_item_colon'] ) : '',
467
- 'aftertext' => __( '(e.g. Parent Actor:)', 'custom-post-type-ui' ),
468
- 'labeltext' => __( 'Parent Item Colon', 'custom-post-type-ui' ),
469
- 'helptext' => esc_attr__( 'Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'custom-post-type-ui'),
470
- ) );
471
-
472
- echo $ui->get_text_input( array(
473
- 'namearray' => 'cpt_tax_labels',
474
- 'name' => 'search_items',
475
- 'textvalue' => ( isset( $current['labels']['search_items'] ) ) ? esc_attr( $current['labels']['search_items'] ) : '',
476
- 'aftertext' => __( '(e.g. Search Actors)', 'custom-post-type-ui' ),
477
- 'labeltext' => __( 'Search Items', 'custom-post-type-ui' ),
478
- 'helptext' => esc_attr__( 'Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'custom-post-type-ui'),
479
- ) );
480
-
481
- echo $ui->get_text_input( array(
482
- 'namearray' => 'cpt_tax_labels',
483
- 'name' => 'popular_items',
484
- 'textvalue' => ( isset( $current['labels']['popular_items'] ) ) ? esc_attr( $current['labels']['popular_items'] ) : null,
485
- 'aftertext' => __( '(e.g. Popular Actors)', 'custom-post-type-ui' ),
486
- 'labeltext' => __( 'Popular Items', 'custom-post-type-ui' ),
487
- 'helptext' => esc_attr__( 'Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'custom-post-type-ui'),
488
- ) );
489
-
490
- echo $ui->get_text_input( array(
491
- 'namearray' => 'cpt_tax_labels',
492
- 'name' => 'separate_items_with_commas',
493
- 'textvalue' => ( isset( $current['labels']['separate_items_with_commas'] ) ) ? esc_attr( $current['labels']['separate_items_with_commas'] ) : null,
494
- 'aftertext' => __( '(e.g. Separate Actors with commas)', 'custom-post-type-ui' ),
495
- 'labeltext' => __( 'Separate Items with Commas', 'custom-post-type-ui' ),
496
- 'helptext' => esc_attr__( 'Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'custom-post-type-ui'),
497
- ) );
498
-
499
- echo $ui->get_text_input( array(
500
- 'namearray' => 'cpt_tax_labels',
501
- 'name' => 'add_or_remove_items',
502
- 'textvalue' => ( isset( $current['labels']['add_or_remove_items'] ) ) ? esc_attr( $current['labels']['add_or_remove_items'] ) : null,
503
- 'aftertext' => __( '(e.g. Add or remove Actors)', 'custom-post-type-ui' ),
504
- 'labeltext' => __( 'Add or Remove Items', 'custom-post-type-ui' ),
505
- 'helptext' => esc_attr__( 'Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'custom-post-type-ui'),
506
- ) );
507
-
508
- echo $ui->get_text_input( array(
509
- 'namearray' => 'cpt_tax_labels',
510
- 'name' => 'choose_from_most_used',
511
- 'textvalue' => ( isset( $current['labels']['choose_from_most_used'] ) ) ? esc_attr( $current['labels']['choose_from_most_used'] ) : null,
512
- 'aftertext' => __( '(e.g. Choose from the most used Actors)', 'custom-post-type-ui' ),
513
- 'labeltext' => __( 'Choose From Most Used', 'custom-post-type-ui' ),
514
- 'helptext' => esc_attr__( 'Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'custom-post-type-ui'),
515
- ) );
516
-
517
- echo $ui->get_text_input( array(
518
- 'namearray' => 'cpt_tax_labels',
519
- 'name' => 'not_found',
520
- 'textvalue' => ( isset( $current['labels']['not_found'] ) ) ? esc_attr( $current['labels']['not_found'] ) : null,
521
- 'aftertext' => __( '(e.g. No Actors found)', 'custom-post-type-ui' ),
522
- 'labeltext' => __( 'Not found', 'custom-post-type-ui' ),
523
- 'helptext' => esc_attr__( 'Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'custom-post-type-ui'),
524
- ) );
525
-
526
- echo $ui->get_text_input( array(
527
- 'namearray' => 'cpt_tax_labels',
528
- 'name' => 'no_terms',
529
- 'textvalue' => ( isset( $current['labels']['no_terms'] ) ) ? esc_attr( $current['labels']['no_terms'] ) : null,
530
- 'aftertext' => __( '(e.g. No actors)', 'custom-post-type-ui' ),
531
- 'labeltext' => __( 'No terms', 'custom-post-type-ui' ),
532
- 'helptext' => esc_attr__( 'Used when indicating that there are no terms in the given taxonomy associated with an object.', 'custom-post-type-ui' ),
533
- ) );
534
-
535
- echo $ui->get_text_input( array(
536
- 'namearray' => 'cpt_tax_labels',
537
- 'name' => 'items_list_navigation',
538
- 'textvalue' => ( isset( $current['labels']['items_list_navigation'] ) ) ? esc_attr( $current['labels']['items_list_navigation'] ) : null,
539
- 'aftertext' => __( '(e.g. Actors list navigation)', 'custom-post-type-ui' ),
540
- 'labeltext' => __( 'Items List Navigation', 'custom-post-type-ui' ),
541
- 'helptext' => esc_attr__( 'Screen reader text for the pagination heading on the term listing screen.', 'custom-post-type-ui' ),
542
- ) );
543
-
544
- echo $ui->get_text_input( array(
545
- 'namearray' => 'cpt_tax_labels',
546
- 'name' => 'items_list',
547
- 'textvalue' => ( isset( $current['labels']['items_list'] ) ) ? esc_attr( $current['labels']['items_list'] ) : null,
548
- 'aftertext' => __( '(e.g. Actors list)', 'custom-post-type-ui' ),
549
- 'labeltext' => __( 'Items List', 'custom-post-type-ui' ),
550
- 'helptext' => esc_attr__( 'Screen reader text for the items list heading on the term listing screen.', 'custom-post-type-ui' ),
551
- ) );
552
- ?>
553
- </table>
554
- <?php echo $ui->get_fieldset_end(); ?>
555
  </div>
556
-
557
- <div class="cptui-section">
558
- <p>
559
- <a href="#" id="togglesettings" class="button-secondary"><?php esc_html_e( 'Edit settings', 'custom-post-type-ui' ); ?></a>
560
- </p>
561
- <?php
562
- $fieldset_classes = '';
563
- echo $ui->get_fieldset_start( array( 'id' => 'settings_expand', 'classes' => array( $fieldset_classes ) ) );
564
- echo $ui->get_legend_start();
565
- esc_html_e( 'Settings', 'custom-post-type-ui' );
566
- echo $ui->get_legend_end();
567
- ?>
568
- <table class="form-table cptui-table">
569
- <?php
570
-
571
- $select = array(
572
- 'options' => array(
573
- array( 'attr' => '0', 'text' => __( 'False', 'custom-post-type-ui' ) ),
574
- array( 'attr' => '1', 'text' => __( 'True', 'custom-post-type-ui' ), 'default' => 'true' )
575
- )
576
- );
577
- $selected = ( isset( $current ) ) ? disp_boolean( $current['public'] ) : '';
578
- $select['selected'] = ( ! empty( $selected ) ) ? $current['public'] : '';
579
- echo $ui->get_select_input( array(
580
- 'namearray' => 'cpt_custom_tax',
581
- 'name' => 'public',
582
- 'labeltext' => __( 'Public', 'custom-post-type-ui' ),
583
- 'aftertext' => __( '(default: true)', 'custom-post-type-ui' ),
584
- 'helptext' => esc_attr__( 'Whether the taxonomy should be publicly queryable.', 'custom-post-type-ui' ),
585
- 'selections' => $select
586
- ) );
587
-
588
- $select = array(
589
- 'options' => array(
590
- array( 'attr' => '0', 'text' => __( 'False', 'custom-post-type-ui' ), 'default' => 'true' ),
591
- array( 'attr' => '1', 'text' => __( 'True', 'custom-post-type-ui' ) )
592
- )
593
- );
594
- $selected = ( isset( $current ) ) ? disp_boolean( $current['hierarchical'] ) : '';
595
- $select['selected'] = ( !empty( $selected ) ) ? $current['hierarchical'] : '';
596
- echo $ui->get_select_input( array(
597
- 'namearray' => 'cpt_custom_tax',
598
- 'name' => 'hierarchical',
599
- 'labeltext' => __( 'Hierarchical', 'custom-post-type-ui' ),
600
- 'aftertext' => __( '(default: false)', 'custom-post-type-ui' ),
601
- 'helptext' => esc_attr__( 'Whether the taxonomy can have parent-child relationships', 'custom-post-type-ui' ),
602
- 'selections' => $select
603
- ) );
604
-
605
- $select = array(
606
- 'options' => array(
607
- array( 'attr' => '0', 'text' => __( 'False', 'custom-post-type-ui' ) ),
608
- array( 'attr' => '1', 'text' => __( 'True', 'custom-post-type-ui' ), 'default' => 'true' )
609
- )
610
- );
611
- $selected = ( isset( $current ) ) ? disp_boolean( $current['show_ui'] ) : '';
612
- $select['selected'] = ( !empty( $selected ) ) ? $current['show_ui'] : '';
613
- echo $ui->get_select_input( array(
614
- 'namearray' => 'cpt_custom_tax',
615
- 'name' => 'show_ui',
616
- 'labeltext' => __( 'Show UI', 'custom-post-type-ui' ),
617
- 'aftertext' => __( '(default: true)', 'custom-post-type-ui' ),
618
- 'helptext' => esc_attr__( 'Whether to generate a default UI for managing this custom taxonomy.', 'custom-post-type-ui' ),
619
- 'selections' => $select
620
- ) );
621
-
622
- $select = array(
623
- 'options' => array(
624
- array( 'attr' => '0', 'text' => __( 'False', 'custom-post-type-ui' ) ),
625
- array( 'attr' => '1', 'text' => __( 'True', 'custom-post-type-ui' ), 'default' => 'true' )
626
- )
627
- );
628
- $selected = ( isset( $current ) ) ? disp_boolean( $current['query_var'] ) : '';
629
- $select['selected'] = ( !empty( $selected ) ) ? $current['query_var'] : '';
630
- echo $ui->get_select_input( array(
631
- 'namearray' => 'cpt_custom_tax',
632
- 'name' => 'query_var',
633
- 'labeltext' => __( 'Query Var', 'custom-post-type-ui' ),
634
- 'aftertext' => __( '(default: true)', 'custom-post-type-ui' ),
635
- 'helptext' => esc_attr__( 'Sets the query_var key for this taxonomy.', 'custom-post-type-ui' ),
636
- 'selections' => $select
637
- ) );
638
-
639
- echo $ui->get_text_input( array(
640
- 'namearray' => 'cpt_custom_tax',
641
- 'name' => 'query_var_slug',
642
- 'textvalue' => ( isset( $current['query_var_slug'] ) ) ? esc_attr( $current['query_var_slug'] ) : '',
643
- 'aftertext' => __( '(default: taxonomy slug). Query var needs to be true to use.', 'custom-post-type-ui' ),
644
- 'labeltext' => __( 'Custom Query Var String', 'custom-post-type-ui' ),
645
- 'helptext' => esc_attr__( 'Sets a custom query_var slug for this taxonomy.', 'custom-post-type-ui'),
646
- ) );
647
-
648
- $select = array(
649
- 'options' => array(
650
- array( 'attr' => '0', 'text' => __( 'False', 'custom-post-type-ui' ) ),
651
- array( 'attr' => '1', 'text' => __( 'True', 'custom-post-type-ui' ), 'default' => 'true' )
652
- )
653
- );
654
- $selected = ( isset( $current ) ) ? disp_boolean( $current['rewrite'] ) : '';
655
- $select['selected'] = ( !empty( $selected ) ) ? $current['rewrite'] : '';
656
- echo $ui->get_select_input( array(
657
- 'namearray' => 'cpt_custom_tax',
658
- 'name' => 'rewrite',
659
- 'labeltext' => __( 'Rewrite', 'custom-post-type-ui' ),
660
- 'aftertext' => __( '(default: true)', 'custom-post-type-ui' ),
661
- 'helptext' => esc_attr__( 'Whether or not WordPress should use rewrites for this taxonomy.', 'custom-post-type-ui' ),
662
- 'selections' => $select
663
- ) );
664
-
665
- echo $ui->get_text_input( array(
666
- 'namearray' => 'cpt_custom_tax',
667
- 'name' => 'rewrite_slug',
668
- 'textvalue' => ( isset( $current['rewrite_slug'] ) ) ? esc_attr( $current['rewrite_slug'] ) : '',
669
- 'aftertext' => __( '(default: taxonomy name)', 'custom-post-type-ui' ),
670
- 'labeltext' => __( 'Custom Rewrite Slug', 'custom-post-type-ui' ),
671
- 'helptext' => esc_attr__( 'Custom taxonomy rewrite slug.', 'custom-post-type-ui'),
672
- ) );
673
-
674
- $select = array(
675
- 'options' => array(
676
- array( 'attr' => '0', 'text' => __( 'False', 'custom-post-type-ui' ) ),
677
- array( 'attr' => '1', 'text' => __( 'True', 'custom-post-type-ui' ), 'default' => 'true' )
678
- )
679
- );
680
- $selected = ( isset( $current ) ) ? disp_boolean( $current['rewrite_withfront'] ) : '';
681
- $select['selected'] = ( !empty( $selected ) ) ? $current['rewrite_withfront'] : '';
682
- echo $ui->get_select_input( array(
683
- 'namearray' => 'cpt_custom_tax',
684
- 'name' => 'rewrite_withfront',
685
- 'labeltext' => __( 'Rewrite With Front', 'custom-post-type-ui' ),
686
- 'aftertext' => __( '(default: true)', 'custom-post-type-ui' ),
687
- 'helptext' => esc_attr__( 'Should the permastruct be prepended with the front base.', 'custom-post-type-ui' ),
688
- 'selections' => $select
689
- ) );
690
-
691
- $select = array(
692
- 'options' => array(
693
- array( 'attr' => '0', 'text' => __( 'False', 'custom-post-type-ui' ), 'default' => 'false' ),
694
- array( 'attr' => '1', 'text' => __( 'True', 'custom-post-type-ui' ) )
695
- )
696
- );
697
- $selected = ( isset( $current ) ) ? disp_boolean( $current['rewrite_hierarchical'] ) : '';
698
- $select['selected'] = ( !empty( $selected ) ) ? $current['rewrite_hierarchical'] : '';
699
- echo $ui->get_select_input( array(
700
- 'namearray' => 'cpt_custom_tax',
701
- 'name' => 'rewrite_hierarchical',
702
- 'labeltext' => __( 'Rewrite Hierarchical', 'custom-post-type-ui' ),
703
- 'aftertext' => __( '(default: false)', 'custom-post-type-ui' ),
704
- 'helptext' => esc_attr__( 'Should the permastruct allow hierarchical urls.', 'custom-post-type-ui' ),
705
- 'selections' => $select
706
- ) );
707
-
708
- $select = array(
709
- 'options' => array(
710
- array( 'attr' => '0', 'text' => __( 'False', 'custom-post-type-ui' ), 'default' => 'true' ),
711
- array( 'attr' => '1', 'text' => __( 'True', 'custom-post-type-ui' ) )
712
- )
713
- );
714
- $selected = ( isset( $current ) ) ? disp_boolean( $current['show_admin_column'] ) : '';
715
- $select['selected'] = ( !empty( $selected ) ) ? $current['show_admin_column'] : '';
716
- echo $ui->get_select_input( array(
717
- 'namearray' => 'cpt_custom_tax',
718
- 'name' => 'show_admin_column',
719
- 'labeltext' => __( 'Show Admin Column', 'custom-post-type-ui' ),
720
- 'aftertext' => __( '(default: false)', 'custom-post-type-ui' ),
721
- 'helptext' => esc_attr__( 'Whether to allow automatic creation of taxonomy columns on associated post-types.', 'custom-post-type-ui' ),
722
- 'selections' => $select
723
- ) );
724
-
725
- $select = array(
726
- 'options' => array(
727
- array( 'attr' => '0', 'text' => __( 'False', 'custom-post-type-ui' ), 'default' => 'false' ),
728
- array( 'attr' => '1', 'text' => __( 'True', 'custom-post-type-ui' ) )
729
- )
730
- );
731
- $selected = ( isset( $current ) ) ? disp_boolean( $current['show_in_rest'] ) : '';
732
- $select['selected'] = ( ! empty( $selected ) ) ? $current['show_in_rest'] : '';
733
- echo $ui->get_select_input( array(
734
- 'namearray' => 'cpt_custom_tax',
735
- 'name' => 'show_in_rest',
736
- 'labeltext' => __( 'Show in REST API', 'custom-post-type-ui' ),
737
- 'aftertext' => __( '(default: false)', 'custom-post-type-ui' ),
738
- 'helptext' => esc_attr__( 'Whether to show this taxonomy data in the WP REST API.', 'custom-post-type-ui' ),
739
- 'selections' => $select
740
- ) );
741
-
742
- echo $ui->get_text_input( array(
743
- 'labeltext' => __( 'REST API base slug', 'custom-post-type-ui' ),
744
- 'helptext' => esc_attr__( 'Slug to use in REST API URLs.', 'custom-post-type-ui' ),
745
- 'namearray' => 'cpt_custom_tax',
746
- 'name' => 'rest_base',
747
- 'textvalue' => ( isset( $current['rest_base'] ) ) ? esc_attr( $current['rest_base'] ) : '',
748
- ) );
749
-
750
- $select = array(
751
- 'options' => array(
752
- array( 'attr' => '0', 'text' => __( 'False', 'custom-post-type-ui' ), 'default' => 'false' ),
753
- array( 'attr' => '1', 'text' => __( 'True', 'custom-post-type-ui' ) )
754
- )
755
- );
756
- $selected = ( isset( $current ) && ! empty( $current['show_in_quick_edit'] ) ) ? disp_boolean( $current['show_in_quick_edit'] ) : '';
757
- $select['selected'] = ( ! empty( $selected ) ) ? $current['show_in_quick_edit'] : '';
758
- echo $ui->get_select_input( array(
759
- 'namearray' => 'cpt_custom_tax',
760
- 'name' => 'show_in_quick_edit',
761
- 'labeltext' => __( 'Show in quick/bulk edit panel.', 'custom-post-type-ui' ),
762
- 'aftertext' => __( '(default: false)', 'custom-post-type-ui' ),
763
- 'helptext' => esc_attr__( 'Whether to show the taxonomy in the quick/bulk edit panel.', 'custom-post-type-ui' ),
764
- 'selections' => $select
765
- ) );
766
- ?>
767
- </table>
768
- <?php echo $ui->get_fieldset_end();
769
-
770
- /**
771
- * Fires after the default fieldsets on the taxonomy screen.
772
- *
773
- * @since 1.3.0
774
- *
775
- * @param cptui_admin_ui $ui Admin UI instance.
776
- */
777
- do_action( 'cptui_taxonomy_after_fieldsets', $ui ); ?>
778
  </div>
779
-
780
- <p class="submit">
781
- <?php wp_nonce_field( 'cptui_addedit_taxonomy_nonce_action', 'cptui_addedit_taxonomy_nonce_field' );
782
- if ( ! empty( $_GET ) && ! empty( $_GET['action'] ) && 'edit' == $_GET['action'] ) { ?>
783
- <?php
784
-
785
- /**
786
- * Filters the text value to use on the button when editing.
787
- *
788
- * @since 1.0.0
789
- *
790
- * @param string $value Text to use for the button.
791
- */
792
- ?>
793
- <input type="submit" class="button-primary" name="cpt_submit" value="<?php echo esc_attr( apply_filters( 'cptui_taxonomy_submit_edit', __( 'Save Taxonomy', 'custom-post-type-ui' ) ) ); ?>" />
794
- <?php
795
-
796
- /**
797
- * Filters the text value to use on the button when deleting.
798
- *
799
- * @since 1.0.0
800
- *
801
- * @param string $value Text to use for the button.
802
- */
803
- ?>
804
- <input type="submit" class="button-secondary" name="cpt_delete" id="cpt_submit_delete" value="<?php echo apply_filters( 'cptui_taxonomy_submit_delete', __( 'Delete Taxonomy', 'custom-post-type-ui' ) ); ?>" />
805
- <?php } else { ?>
806
- <?php
807
-
808
- /**
809
- * Filters the text value to use on the button when adding.
810
- *
811
- * @since 1.0.0
812
- *
813
- * @param string $value Text to use for the button.
814
- */
815
- ?>
816
- <input type="submit" class="button-primary" name="cpt_submit" value="<?php echo esc_attr( apply_filters( 'cptui_taxonomy_submit_add', __( 'Add Taxonomy', 'custom-post-type-ui' ) ) ); ?>" />
817
- <?php } ?>
818
-
819
- <?php if ( ! empty( $current ) ) { ?>
820
- <input type="hidden" name="tax_original" id="tax_original" value="<?php echo $current['name']; ?>" />
821
- <?php }
822
-
823
- // Used to check and see if we should prevent duplicate slugs ?>
824
- <input type="hidden" name="cpt_tax_status" id="cpt_tax_status" value="<?php echo $tab; ?>" />
825
- </p>
826
  </form>
827
  </div><!-- End .wrap -->
828
  <?php
@@ -834,17 +916,16 @@ function cptui_manage_taxonomies() {
834
  * @since 1.0.0
835
  *
836
  * @param array $taxonomies Array of taxonomies that are registered.
837
- * @return string HTML select dropdown.
838
  */
839
  function cptui_taxonomies_dropdown( $taxonomies = array() ) {
840
 
841
  $ui = new cptui_admin_ui();
842
 
843
- if ( !empty( $taxonomies ) ) {
844
  $select = array();
845
  $select['options'] = array();
846
 
847
- foreach( $taxonomies as $tax ) {
848
  $text = ( ! empty( $tax['label'] ) ) ? $tax['label'] : $tax['name'];
849
  $select['options'][] = array( 'attr' => $tax['name'], 'text' => $text );
850
  }
@@ -856,7 +937,7 @@ function cptui_taxonomies_dropdown( $taxonomies = array() ) {
856
  'namearray' => 'cptui_selected_taxonomy',
857
  'name' => 'taxonomy',
858
  'selections' => $select,
859
- 'wrap' => false
860
  ) );
861
  }
862
  }
@@ -875,24 +956,20 @@ function cptui_get_current_taxonomy( $taxonomy_deleted = false ) {
875
 
876
  $tax = false;
877
 
878
- if ( !empty( $_POST ) ) {
879
  if ( isset( $_POST['cptui_selected_taxonomy']['taxonomy'] ) ) {
880
  $tax = sanitize_text_field( $_POST['cptui_selected_taxonomy']['taxonomy'] );
881
- }
882
-
883
- if ( $taxonomy_deleted ) {
884
  $taxonomies = cptui_get_taxonomy_data();
885
  $tax = key( $taxonomies );
886
- }
887
-
888
- if ( isset( $_POST['cpt_custom_tax']['name'] ) ) {
889
  $tax = sanitize_text_field( $_POST['cpt_custom_tax']['name'] );
890
  }
891
- } else if ( !empty( $_GET ) && isset( $_GET['cptui_taxonomy'] ) ) {
892
  $tax = sanitize_text_field( $_GET['cptui_taxonomy'] );
893
  } else {
894
  $taxonomies = cptui_get_taxonomy_data();
895
- if ( !empty( $taxonomies ) ) {
896
  // Will return the first array key.
897
  $tax = key( $taxonomies );
898
  }
@@ -915,7 +992,7 @@ function cptui_get_current_taxonomy( $taxonomy_deleted = false ) {
915
  *
916
  * @internal
917
  *
918
- * @param $data array $_POST values.
919
  * @return bool|string False on failure, string on success.
920
  */
921
  function cptui_delete_taxonomy( $data = array() ) {
@@ -923,14 +1000,14 @@ function cptui_delete_taxonomy( $data = array() ) {
923
  if ( is_string( $data ) && taxonomy_exists( $data ) ) {
924
  $data = array(
925
  'cpt_custom_tax' => array(
926
- 'name' => $data
927
- )
928
  );
929
  }
930
 
931
  // Check if they selected one to delete.
932
  if ( empty( $data['cpt_custom_tax']['name'] ) ) {
933
- return cptui_admin_notices( 'error', '', false, __( 'Please provide a taxonomy to delete', 'custom-post-type-ui' ) );
934
  }
935
 
936
  /**
@@ -975,9 +1052,9 @@ function cptui_delete_taxonomy( $data = array() ) {
975
  set_transient( 'cptui_flush_rewrite_rules', 'true', 5 * 60 );
976
 
977
  if ( isset( $success ) ) {
978
- return cptui_admin_notices( 'delete', $data['cpt_custom_tax']['name'], $success );
979
  }
980
- return false;
981
  }
982
 
983
  /**
@@ -1003,11 +1080,11 @@ function cptui_update_taxonomy( $data = array() ) {
1003
 
1004
  // They need to provide a name.
1005
  if ( empty( $data['cpt_custom_tax']['name'] ) ) {
1006
- return cptui_admin_notices( 'error', '', false, __( 'Please provide a taxonomy name', 'custom-post-type-ui' ) );
1007
  }
1008
 
1009
  if ( empty( $data['cpt_post_types'] ) ) {
1010
- return cptui_admin_notices( 'error', '', false, __( 'Please provide a post type to attach to.', 'custom-post-type-ui' ) );
1011
  }
1012
 
1013
  if ( ! empty( $data['tax_original'] ) && $data['tax_original'] != $data['cpt_custom_tax']['name'] ) {
@@ -1016,7 +1093,7 @@ function cptui_update_taxonomy( $data = array() ) {
1016
  }
1017
  }
1018
 
1019
- foreach( $data as $key => $value ) {
1020
  if ( is_string( $value ) ) {
1021
  $data[ $key ] = sanitize_text_field( $value );
1022
  } else {
@@ -1029,7 +1106,8 @@ function cptui_update_taxonomy( $data = array() ) {
1029
  false !== strpos( $data['cpt_custom_tax']['rewrite_slug'], '\'' ) ||
1030
  false !== strpos( $data['cpt_custom_tax']['rewrite_slug'], '\"' ) ) {
1031
 
1032
- return cptui_admin_notices( 'error', '', false, __( 'Please do not use quotes in taxonomy names or rewrite slugs', 'custom-post-type-ui' ) );
 
1033
  }
1034
 
1035
  $taxonomies = cptui_get_taxonomy_data();
@@ -1046,11 +1124,12 @@ function cptui_update_taxonomy( $data = array() ) {
1046
  $slug_exists = apply_filters( 'cptui_taxonomy_slug_exists', false, $data['cpt_custom_tax']['name'], $taxonomies );
1047
  if ( 'new' == $data['cpt_tax_status'] ) {
1048
  if ( true === $slug_exists ) {
1049
- return cptui_admin_notices( 'error', '', false, sprintf( __( 'Please choose a different taxonomy name. %s is already registered.', 'custom-post-type-ui' ), $data['cpt_custom_tax']['name'] ) );
 
1050
  }
1051
  }
1052
 
1053
- foreach( $data['cpt_tax_labels'] as $key => $label ) {
1054
  if ( empty( $label ) ) {
1055
  unset( $data['cpt_tax_labels'][ $key ] );
1056
  }
@@ -1087,6 +1166,8 @@ function cptui_update_taxonomy( $data = array() ) {
1087
  'public' => disp_boolean( $data['cpt_custom_tax']['public'] ),
1088
  'hierarchical' => disp_boolean( $data['cpt_custom_tax']['hierarchical'] ),
1089
  'show_ui' => disp_boolean( $data['cpt_custom_tax']['show_ui'] ),
 
 
1090
  'query_var' => disp_boolean( $data['cpt_custom_tax']['query_var'] ),
1091
  'query_var_slug' => $query_var_slug,
1092
  'rewrite' => disp_boolean( $data['cpt_custom_tax']['rewrite'] ),
@@ -1097,7 +1178,7 @@ function cptui_update_taxonomy( $data = array() ) {
1097
  'show_in_rest' => disp_boolean( $data['cpt_custom_tax']['show_in_rest'] ),
1098
  'show_in_quick_edit' => $show_quickpanel_bulk,
1099
  'rest_base' => $rest_base,
1100
- 'labels' => $data['cpt_tax_labels']
1101
  );
1102
 
1103
  $taxonomies[ $data['cpt_custom_tax']['name'] ]['object_types'] = $data['cpt_post_types'];
@@ -1129,11 +1210,11 @@ function cptui_update_taxonomy( $data = array() ) {
1129
 
1130
  if ( isset( $success ) ) {
1131
  if ( 'new' == $data['cpt_tax_status'] ) {
1132
- return cptui_admin_notices( 'add', $data['cpt_custom_tax']['name'], $success );
1133
  }
1134
  }
1135
 
1136
- return cptui_admin_notices( 'update', $data['cpt_custom_tax']['name'], true );
1137
  }
1138
 
1139
  /**
@@ -1316,3 +1397,39 @@ function cptui_check_existing_taxonomy_slugs( $slug_exists = false, $taxonomy_sl
1316
  return $slug_exists;
1317
  }
1318
  add_filter( 'cptui_taxonomy_slug_exists', 'cptui_check_existing_taxonomy_slugs', 10, 3 );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  */
23
  function cptui_taxonomies_enqueue_scripts() {
24
 
25
+ $current_screen = get_current_screen();
26
 
27
+ if ( ! is_object( $current_screen ) || 'cpt-ui_page_cptui_manage_taxonomies' !== $current_screen->base ) {
28
  return;
29
  }
30
 
35
  wp_enqueue_script( 'cptui' );
36
  wp_localize_script( 'cptui', 'cptui_tax_data',
37
  array(
38
+ 'confirm' => esc_html__( 'Are you sure you want to delete this? Deleting will NOT remove created content.', 'custom-post-type-ui' ),
39
+ 'no_associated_type' => esc_html( 'Please select a post type to associate with.', 'custom-post-type-ui' )
40
  )
41
  );
42
  }
55
  */
56
  function cptui_taxonomy_tabs( $tabs = array(), $current_page = '' ) {
57
 
58
+ if ( 'taxonomies' === $current_page ) {
59
  $taxonomies = cptui_get_taxonomy_data();
60
  $classes = array( 'nav-tab' );
61
 
62
+ $tabs['page_title'] = esc_html__( 'Manage Taxonomies', 'custom-post-type-ui' );
63
  $tabs['tabs'] = array();
64
  // Start out with our basic "Add new" tab.
65
  $tabs['tabs']['add'] = array(
66
+ 'text' => esc_html__( 'Add New Taxonomy', 'custom-post-type-ui' ),
67
  'classes' => $classes,
68
  'url' => cptui_admin_url( 'admin.php?page=cptui_manage_' . $current_page ),
69
+ 'aria-selected' => 'false',
70
  );
71
 
72
  $action = cptui_get_current_action();
81
  $classes[] = 'nav-tab-active';
82
  }
83
  $tabs['tabs']['edit'] = array(
84
+ 'text' => esc_html__( 'Edit Taxonomies', 'custom-post-type-ui' ),
85
  'classes' => $classes,
86
  'url' => esc_url( add_query_arg( array( 'action' => 'edit' ), cptui_admin_url( 'admin.php?page=cptui_manage_' . $current_page ) ) ),
87
+ 'aria-selected' => ( ! empty( $action ) ) ? 'true' : 'false',
88
  );
89
 
90
  $tabs['tabs']['view'] = array(
91
+ 'text' => esc_html__( 'View Taxonomies', 'custom-post-type-ui' ),
92
  'classes' => array( 'nav-tab' ), // Prevent notices.
93
  'url' => esc_url( cptui_admin_url( 'admin.php?page=cptui_listings#taxonomies' ) ),
94
+ 'aria-selected' => 'false',
95
+ );
96
+
97
+ $tabs['tabs']['export'] = array(
98
+ 'text' => esc_html__( 'Import/Export Taxonomies', 'custom-post-type-ui' ),
99
+ 'classes' => array( 'nav-tab' ), // Prevent notices.
100
+ 'url' => esc_url( cptui_admin_url( 'admin.php?page=cptui_importexport&action=taxonomies' ) ),
101
+ 'aria-selected' => 'false',
102
  );
103
  }
104
  }
117
  */
118
  function cptui_manage_taxonomies() {
119
 
120
+ $tab = ( ! empty( $_GET ) && ! empty( $_GET['action'] ) && 'edit' == $_GET['action'] ) ? 'edit' : 'new';
 
 
 
 
 
 
 
 
 
 
 
 
 
121
  $tab_class = 'cptui-' . $tab; ?>
122
 
123
  <div class="wrap <?php echo esc_attr( $tab_class ); ?>">
130
  */
131
  do_action( 'cptui_inside_taxonomy_wrap' );
132
 
133
+ /**
134
+ * Filters whether or not a taxonomy was deleted.
135
+ *
136
+ * @since 1.4.0
137
+ *
138
+ * @param bool $value Whether or not taxonomy deleted. Default false.
139
+ */
140
+ $taxonomy_deleted = apply_filters( 'cptui_taxonomy_deleted', false );
141
 
142
  // Create our tabs.
143
  cptui_settings_tab_menu( $page = 'taxonomies' );
165
  $ui = new cptui_admin_ui();
166
 
167
  // Will only be set if we're already on the edit screen.
168
+ if ( ! empty( $taxonomies ) ) { ?>
169
  <form id="cptui_select_taxonomy" method="post" action="<?php echo esc_url( cptui_get_post_form_action( $ui ) ); ?>">
170
+ <label for="taxonomy"><?php esc_html_e( 'Select: ', 'custom-post-type-ui' ); ?></label>
171
  <?php
172
  cptui_taxonomies_dropdown( $taxonomies );
173
 
179
  * @param string $value Text to use for the button.
180
  */
181
  ?>
182
+ <input type="submit" class="button-secondary" name="cptui_select_taxonomy_submit" value="<?php echo esc_attr( apply_filters( 'cptui_taxonomy_submit_select', esc_attr__( 'Select', 'custom-post-type-ui' ) ) ); ?>" />
183
  </form>
184
  <?php
185
 
186
+ /**
187
+ * Fires below the taxonomy select input.
188
+ *
189
+ * @since 1.1.0
190
+ *
191
+ * @param string $value Current taxonomy selected.
192
+ */
193
+ do_action( 'cptui_below_taxonomy_select', $current['name'] );
194
  } ?>
195
 
196
  <form class="taxonomiesui" method="post" action="<?php echo esc_url( cptui_get_post_form_action( $ui ) ); ?>">
197
+ <div class="postbox-container">
198
+ <div id="poststuff">
199
+ <div class="cptui-section postbox">
200
+ <button type="button" class="handlediv button-link" aria-expanded="true">
201
+ <span class="screen-reader-text"><?php esc_html_e( 'Toggle panel: Basic settings', 'custom-post-type-ui' ); ?></span>
202
+ <span class="toggle-indicator" aria-hidden="true"></span>
203
+ </button>
204
+ <h2 class="hndle">
205
+ <span><?php esc_html_e( 'Basic settings', 'custom-post-type-ui' ); ?></span>
206
+ </h2>
207
+ <div class="inside">
208
+ <div class="main">
209
+ <table class="form-table cptui-table">
210
+ <?php
211
+ echo $ui->get_tr_start() . $ui->get_th_start();
212
+ echo $ui->get_label( 'name', esc_html__( 'Taxonomy Slug', 'custom-post-type-ui' ) ) . $ui->get_required_span();
213
+
214
+ if ( 'edit' == $tab ) {
215
+ echo '<p id="slugchanged" class="hidemessage">' . __( 'Slug has changed', 'custom_post_type_ui' ) . '</p>';
216
+ }
217
+ echo $ui->get_th_end() . $ui->get_td_start();
218
+
219
+ echo $ui->get_text_input( array(
220
+ 'namearray' => 'cpt_custom_tax',
221
+ 'name' => 'name',
222
+ 'textvalue' => ( isset( $current['name'] ) ) ? esc_attr( $current['name'] ) : '',
223
+ 'maxlength' => '32',
224
+ 'helptext' => esc_attr__( 'The taxonomy name/slug. Used for various queries for taxonomy content.', 'custom-post-type-ui' ),
225
+ 'required' => true,
226
+ 'placeholder' => false,
227
+ 'wrap' => false,
228
+ ) );
229
+
230
+ echo '<p class="cptui-slug-details">';
231
+ esc_html_e( 'Slugs should only contain alphanumeric, latin characters. Underscores or dashes should be used in place of spaces.', 'custom-post-type-ui' );
232
+ echo '</p>';
233
+
234
+ if ( 'edit' == $tab ) {
235
+ echo '<p>';
236
+ esc_html_e( 'DO NOT EDIT the taxonomy slug unless also planning to migrate terms. Changing the slug registers a new taxonomy entry.', 'custom-post-type-ui' );
237
+ echo '</p>';
238
+
239
+ echo '<div class="cptui-spacer">';
240
+ echo $ui->get_check_input( array(
241
+ 'checkvalue' => 'update_taxonomy',
242
+ 'checked' => 'false',
243
+ 'name' => 'update_taxonomy',
244
+ 'namearray' => 'update_taxonomy',
245
+ 'labeltext' => esc_html__( 'Migrate terms to newly renamed taxonomy?', 'custom-post-type-ui' ),
246
+ 'helptext' => '',
247
+ 'default' => false,
248
+ 'wrap' => false,
249
+ ) );
250
+ echo '</div>';
251
+ }
252
+
253
+ echo $ui->get_text_input( array(
254
+ 'namearray' => 'cpt_custom_tax',
255
+ 'name' => 'label',
256
+ 'textvalue' => ( isset( $current['label'] ) ) ? esc_attr( $current['label'] ) : '',
257
+ 'aftertext' => esc_html__( '(e.g. Actors)', 'custom-post-type-ui' ),
258
+ 'labeltext' => esc_html__( 'Plural Label', 'custom-post-type-ui' ),
259
+ 'helptext' => esc_attr__( 'Used for the taxonomy admin menu item.', 'custom-post-type-ui' ),
260
+ 'required' => true,
261
+ ) );
262
+
263
+ echo $ui->get_text_input( array(
264
+ 'namearray' => 'cpt_custom_tax',
265
+ 'name' => 'singular_label',
266
+ 'textvalue' => ( isset( $current['singular_label'] ) ) ? esc_attr( $current['singular_label'] ) : '',
267
+ 'aftertext' => esc_html__( '(e.g. Actor)', 'custom-post-type-ui' ),
268
+ 'labeltext' => esc_html__( 'Singular Label', 'custom-post-type-ui' ),
269
+ 'helptext' => esc_attr__( 'Used when a singular label is needed.', 'custom-post-type-ui' ),
270
+ 'required' => true,
271
+ ) );
272
+
273
+ echo $ui->get_td_end() . $ui->get_tr_end();
274
+
275
+ echo $ui->get_tr_start() . $ui->get_th_start() . esc_html__( 'Attach to Post Type', 'custom-post-type-ui' ) . $ui->get_required_span();
276
+ echo $ui->get_p( esc_html__( 'Add support for available registered post types. At least one is required.', 'custom-post-type-ui' ) );
277
+ echo $ui->get_th_end() . $ui->get_td_start() . $ui->get_fieldset_start();
278
+
279
+ /**
280
+ * Filters the arguments for post types to list for taxonomy association.
281
+ *
282
+ * @since 1.0.0
283
+ *
284
+ * @param array $value Array of default arguments.
285
+ */
286
+ $args = apply_filters( 'cptui_attach_post_types_to_taxonomy', array( 'public' => true ) );
287
+
288
+ // If they don't return an array, fall back to the original default. Don't need to check for empty, because empty array is default for $args param in get_post_types anyway.
289
+ if ( ! is_array( $args ) ) {
290
+ $args = array( 'public' => true );
291
+ }
292
+ $output = 'objects'; // Or objects.
293
+
294
+ /**
295
+ * Filters the results returned to display for available post types for taxonomy.
296
+ *
297
+ * @since 1.3.0
298
+ *
299
+ * @param array $value Array of post type objects.
300
+ * @param array $args Array of arguments for the post type query.
301
+ * @param string $output The output type we want for the results.
302
+ */
303
+ $post_types = apply_filters( 'cptui_get_post_types_for_taxonomies', get_post_types( $args, $output ), $args, $output );
304
+
305
+ foreach ( $post_types as $post_type ) {
306
+ $core_label = ( in_array( $post_type->name, array(
307
+ 'post',
308
+ 'page',
309
+ 'attachment',
310
+ ) ) ) ? esc_html__( '(WP Core)', 'custom-post-type-ui' ) : '';
311
+ echo $ui->get_check_input( array(
312
+ 'checkvalue' => $post_type->name,
313
+ 'checked' => ( ! empty( $current['object_types'] ) && is_array( $current['object_types'] ) && in_array( $post_type->name, $current['object_types'] ) ) ? 'true' : 'false',
314
+ 'name' => $post_type->name,
315
+ 'namearray' => 'cpt_post_types',
316
+ 'textvalue' => $post_type->name,
317
+ 'labeltext' => $post_type->label . ' ' . $core_label,
318
+ 'wrap' => false,
319
+ ) );
320
+ }
321
+
322
+ echo $ui->get_fieldset_end() . $ui->get_td_end() . $ui->get_tr_end();
323
+ ?>
324
+ </table>
325
+ <p class="submit">
326
+ <?php wp_nonce_field( 'cptui_addedit_taxonomy_nonce_action', 'cptui_addedit_taxonomy_nonce_field' );
327
+ if ( ! empty( $_GET ) && ! empty( $_GET['action'] ) && 'edit' == $_GET['action'] ) { ?>
328
+ <?php
329
+
330
+ /**
331
+ * Filters the text value to use on the button when editing.
332
+ *
333
+ * @since 1.0.0
334
+ *
335
+ * @param string $value Text to use for the button.
336
+ */
337
+ ?>
338
+ <input type="submit" class="button-primary" name="cpt_submit" value="<?php echo esc_attr( apply_filters( 'cptui_taxonomy_submit_edit', esc_attr__( 'Save Taxonomy', 'custom-post-type-ui' ) ) ); ?>" />
339
+ <?php
340
+
341
+ /**
342
+ * Filters the text value to use on the button when deleting.
343
+ *
344
+ * @since 1.0.0
345
+ *
346
+ * @param string $value Text to use for the button.
347
+ */
348
+ ?>
349
+ <input type="submit" class="button-secondary" name="cpt_delete" id="cpt_submit_delete" value="<?php echo esc_attr( apply_filters( 'cptui_taxonomy_submit_delete', __( 'Delete Taxonomy', 'custom-post-type-ui' ) ) ); ?>" />
350
+ <?php } else { ?>
351
+ <?php
352
+
353
+ /**
354
+ * Filters the text value to use on the button when adding.
355
+ *
356
+ * @since 1.0.0
357
+ *
358
+ * @param string $value Text to use for the button.
359
+ */
360
+ ?>
361
+ <input type="submit" class="button-primary cptui-taxonomy-submit" name="cpt_submit" value="<?php echo esc_attr( apply_filters( 'cptui_taxonomy_submit_add', esc_attr__( 'Add Taxonomy', 'custom-post-type-ui' ) ) ); ?>" />
362
+ <?php } ?>
363
+
364
+ <?php if ( ! empty( $current ) ) { ?>
365
+ <input type="hidden" name="tax_original" id="tax_original" value="<?php echo esc_attr( $current['name'] ); ?>" />
366
+ <?php }
367
+
368
+ // Used to check and see if we should prevent duplicate slugs. ?>
369
+ <input type="hidden" name="cpt_tax_status" id="cpt_tax_status" value="<?php echo esc_attr( $tab ); ?>" />
370
+ </p>
371
+ </div>
372
+ </div>
373
+ </div>
374
+ <div class="cptui-section postbox">
375
+ <button type="button" class="handlediv button-link" aria-expanded="true">
376
+ <span class="screen-reader-text"><?php esc_html_e( 'Toggle panel: Additional labels', 'custom-post-type-ui' ); ?></span>
377
+ <span class="toggle-indicator" aria-hidden="true"></span>
378
+ </button>
379
+ <h2 class="hndle">
380
+ <span><?php esc_html_e( 'Additional labels', 'custom-post-type-ui' ); ?></span>
381
+ </h2>
382
+ <div class="inside">
383
+ <div class="main">
384
+ <table class="form-table cptui-table">
385
+
386
+ <?php
387
+ if ( isset( $current['description'] ) ) {
388
+ $current['description'] = stripslashes_deep( $current['description'] );
389
+ }
390
+ echo $ui->get_textarea_input( array(
391
+ 'namearray' => 'cpt_custom_tax',
392
+ 'name' => 'description',
393
+ 'rows' => '4',
394
+ 'cols' => '40',
395
+ 'textvalue' => ( isset( $current['description'] ) ) ? esc_textarea( $current['description'] ) : '',
396
+ 'labeltext' => esc_html__( 'Description', 'custom-post-type-ui' ),
397
+ 'helptext' => esc_attr__( 'Describe what your taxonomy is used for.', 'custom-post-type-ui' ),
398
+ ) );
399
+
400
+ echo $ui->get_text_input( array(
401
+ 'namearray' => 'cpt_tax_labels',
402
+ 'name' => 'menu_name',
403
+ 'textvalue' => ( isset( $current['labels']['menu_name'] ) ) ? esc_attr( $current['labels']['menu_name'] ) : '',
404
+ 'aftertext' => esc_attr__( '(e.g. Actors)', 'custom-post-type-ui' ),
405
+ 'labeltext' => esc_html__( 'Menu Name', 'custom-post-type-ui' ),
406
+ 'helptext' => esc_html__( 'Custom admin menu name for your taxonomy.', 'custom-post-type-ui' ),
407
+ ) );
408
+
409
+ echo $ui->get_text_input( array(
410
+ 'namearray' => 'cpt_tax_labels',
411
+ 'name' => 'all_items',
412
+ 'textvalue' => ( isset( $current['labels']['all_items'] ) ) ? esc_attr( $current['labels']['all_items'] ) : '',
413
+ 'aftertext' => esc_attr__( '(e.g. All Actors)', 'custom-post-type-ui' ),
414
+ 'labeltext' => esc_html__( 'All Items', 'custom-post-type-ui' ),
415
+ 'helptext' => esc_html__( 'Used as tab text when showing all terms for hierarchical taxonomy while editing post.', 'custom-post-type-ui' ),
416
+ ) );
417
+
418
+ echo $ui->get_text_input( array(
419
+ 'namearray' => 'cpt_tax_labels',
420
+ 'name' => 'edit_item',
421
+ 'textvalue' => ( isset( $current['labels']['edit_item'] ) ) ? esc_attr( $current['labels']['edit_item'] ) : '',
422
+ 'aftertext' => esc_attr__( '(e.g. Edit Actor)', 'custom-post-type-ui' ),
423
+ 'labeltext' => esc_html__( 'Edit Item', 'custom-post-type-ui' ),
424
+ 'helptext' => esc_html__( 'Used at the top of the term editor screen for an existing taxonomy term.', 'custom-post-type-ui' ),
425
+ ) );
426
+
427
+ echo $ui->get_text_input( array(
428
+ 'namearray' => 'cpt_tax_labels',
429
+ 'name' => 'view_item',
430
+ 'textvalue' => ( isset( $current['labels']['view_item'] ) ) ? esc_attr( $current['labels']['view_item'] ) : '',
431
+ 'aftertext' => esc_attr__( '(e.g. View Actor)', 'custom-post-type-ui' ),
432
+ 'labeltext' => esc_html__( 'View Item', 'custom-post-type-ui' ),
433
+ 'helptext' => esc_html__( 'Used in the admin bar when viewing editor screen for an existing taxonomy term.', 'custom-post-type-ui' ),
434
+ ) );
435
+
436
+ echo $ui->get_text_input( array(
437
+ 'namearray' => 'cpt_tax_labels',
438
+ 'name' => 'update_item',
439
+ 'textvalue' => ( isset( $current['labels']['update_item'] ) ) ? esc_attr( $current['labels']['update_item'] ) : '',
440
+ 'aftertext' => esc_attr__( '(e.g. Update Actor Name)', 'custom-post-type-ui' ),
441
+ 'labeltext' => esc_html__( 'Update Item Name', 'custom-post-type-ui' ),
442
+ 'helptext' => esc_html__( 'Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'custom-post-type-ui' ),
443
+ ) );
444
+
445
+ echo $ui->get_text_input( array(
446
+ 'namearray' => 'cpt_tax_labels',
447
+ 'name' => 'add_new_item',
448
+ 'textvalue' => ( isset( $current['labels']['add_new_item'] ) ) ? esc_attr( $current['labels']['add_new_item'] ) : '',
449
+ 'aftertext' => esc_attr__( '(e.g. Add New Actor)', 'custom-post-type-ui' ),
450
+ 'labeltext' => esc_html__( 'Add New Item', 'custom-post-type-ui' ),
451
+ 'helptext' => esc_html__( 'Used at the top of the term editor screen and button text for a new taxonomy term.', 'custom-post-type-ui' ),
452
+ ) );
453
+
454
+ echo $ui->get_text_input( array(
455
+ 'namearray' => 'cpt_tax_labels',
456
+ 'name' => 'new_item_name',
457
+ 'textvalue' => ( isset( $current['labels']['new_item_name'] ) ) ? esc_attr( $current['labels']['new_item_name'] ) : '',
458
+ 'aftertext' => esc_attr__( '(e.g. New Actor Name)', 'custom-post-type-ui' ),
459
+ 'labeltext' => esc_html__( 'New Item Name', 'custom-post-type-ui' ),
460
+ 'helptext' => esc_html__( 'Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'custom-post-type-ui' ),
461
+ ) );
462
+
463
+ echo $ui->get_text_input( array(
464
+ 'namearray' => 'cpt_tax_labels',
465
+ 'name' => 'parent_item',
466
+ 'textvalue' => ( isset( $current['labels']['parent_item'] ) ) ? esc_attr( $current['labels']['parent_item'] ) : '',
467
+ 'aftertext' => esc_attr__( '(e.g. Parent Actor)', 'custom-post-type-ui' ),
468
+ 'labeltext' => esc_html__( 'Parent Item', 'custom-post-type-ui' ),
469
+ 'helptext' => esc_html__( 'Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'custom-post-type-ui' ),
470
+ ) );
471
+
472
+ echo $ui->get_text_input( array(
473
+ 'namearray' => 'cpt_tax_labels',
474
+ 'name' => 'parent_item_colon',
475
+ 'textvalue' => ( isset( $current['labels']['parent_item_colon'] ) ) ? esc_attr( $current['labels']['parent_item_colon'] ) : '',
476
+ 'aftertext' => esc_attr__( '(e.g. Parent Actor:)', 'custom-post-type-ui' ),
477
+ 'labeltext' => esc_html__( 'Parent Item Colon', 'custom-post-type-ui' ),
478
+ 'helptext' => esc_html__( 'Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'custom-post-type-ui' ),
479
+ ) );
480
+
481
+ echo $ui->get_text_input( array(
482
+ 'namearray' => 'cpt_tax_labels',
483
+ 'name' => 'search_items',
484
+ 'textvalue' => ( isset( $current['labels']['search_items'] ) ) ? esc_attr( $current['labels']['search_items'] ) : '',
485
+ 'aftertext' => esc_attr__( '(e.g. Search Actors)', 'custom-post-type-ui' ),
486
+ 'labeltext' => esc_html__( 'Search Items', 'custom-post-type-ui' ),
487
+ 'helptext' => esc_html__( 'Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'custom-post-type-ui' ),
488
+ ) );
489
+
490
+ echo $ui->get_text_input( array(
491
+ 'namearray' => 'cpt_tax_labels',
492
+ 'name' => 'popular_items',
493
+ 'textvalue' => ( isset( $current['labels']['popular_items'] ) ) ? esc_attr( $current['labels']['popular_items'] ) : null,
494
+ 'aftertext' => esc_attr__( '(e.g. Popular Actors)', 'custom-post-type-ui' ),
495
+ 'labeltext' => esc_html__( 'Popular Items', 'custom-post-type-ui' ),
496
+ 'helptext' => esc_html__( 'Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'custom-post-type-ui' ),
497
+ ) );
498
+
499
+ echo $ui->get_text_input( array(
500
+ 'namearray' => 'cpt_tax_labels',
501
+ 'name' => 'separate_items_with_commas',
502
+ 'textvalue' => ( isset( $current['labels']['separate_items_with_commas'] ) ) ? esc_attr( $current['labels']['separate_items_with_commas'] ) : null,
503
+ 'aftertext' => esc_attr__( '(e.g. Separate Actors with commas)', 'custom-post-type-ui' ),
504
+ 'labeltext' => esc_html__( 'Separate Items with Commas', 'custom-post-type-ui' ),
505
+ 'helptext' => esc_html__( 'Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'custom-post-type-ui' ),
506
+ ) );
507
+
508
+ echo $ui->get_text_input( array(
509
+ 'namearray' => 'cpt_tax_labels',
510
+ 'name' => 'add_or_remove_items',
511
+ 'textvalue' => ( isset( $current['labels']['add_or_remove_items'] ) ) ? esc_attr( $current['labels']['add_or_remove_items'] ) : null,
512
+ 'aftertext' => esc_attr__( '(e.g. Add or remove Actors)', 'custom-post-type-ui' ),
513
+ 'labeltext' => esc_html__( 'Add or Remove Items', 'custom-post-type-ui' ),
514
+ 'helptext' => esc_html__( 'Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'custom-post-type-ui' ),
515
+ ) );
516
+
517
+ echo $ui->get_text_input( array(
518
+ 'namearray' => 'cpt_tax_labels',
519
+ 'name' => 'choose_from_most_used',
520
+ 'textvalue' => ( isset( $current['labels']['choose_from_most_used'] ) ) ? esc_attr( $current['labels']['choose_from_most_used'] ) : null,
521
+ 'aftertext' => esc_attr__( '(e.g. Choose from the most used Actors)', 'custom-post-type-ui' ),
522
+ 'labeltext' => esc_html__( 'Choose From Most Used', 'custom-post-type-ui' ),
523
+ 'helptext' => esc_html__( 'Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'custom-post-type-ui' ),
524
+ ) );
525
+
526
+ echo $ui->get_text_input( array(
527
+ 'namearray' => 'cpt_tax_labels',
528
+ 'name' => 'not_found',
529
+ 'textvalue' => ( isset( $current['labels']['not_found'] ) ) ? esc_attr( $current['labels']['not_found'] ) : null,
530
+ 'aftertext' => esc_attr__( '(e.g. No Actors found)', 'custom-post-type-ui' ),
531
+ 'labeltext' => esc_html__( 'Not found', 'custom-post-type-ui' ),
532
+ 'helptext' => esc_html__( 'Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'custom-post-type-ui' ),
533
+ ) );
534
+
535
+ echo $ui->get_text_input( array(
536
+ 'namearray' => 'cpt_tax_labels',
537
+ 'name' => 'no_terms',
538
+ 'textvalue' => ( isset( $current['labels']['no_terms'] ) ) ? esc_attr( $current['labels']['no_terms'] ) : null,
539
+ 'aftertext' => esc_html__( '(e.g. No actors)', 'custom-post-type-ui' ),
540
+ 'labeltext' => esc_html__( 'No terms', 'custom-post-type-ui' ),
541
+ 'helptext' => esc_attr__( 'Used when indicating that there are no terms in the given taxonomy associated with an object.', 'custom-post-type-ui' ),
542
+ ) );
543
+
544
+ echo $ui->get_text_input( array(
545
+ 'namearray' => 'cpt_tax_labels',
546
+ 'name' => 'items_list_navigation',
547
+ 'textvalue' => ( isset( $current['labels']['items_list_navigation'] ) ) ? esc_attr( $current['labels']['items_list_navigation'] ) : null,
548
+ 'aftertext' => esc_html__( '(e.g. Actors list navigation)', 'custom-post-type-ui' ),
549
+ 'labeltext' => esc_html__( 'Items List Navigation', 'custom-post-type-ui' ),
550
+ 'helptext' => esc_attr__( 'Screen reader text for the pagination heading on the term listing screen.', 'custom-post-type-ui' ),
551
+ ) );
552
+
553
+ echo $ui->get_text_input( array(
554
+ 'namearray' => 'cpt_tax_labels',
555
+ 'name' => 'items_list',
556
+ 'textvalue' => ( isset( $current['labels']['items_list'] ) ) ? esc_attr( $current['labels']['items_list'] ) : null,
557
+ 'aftertext' => esc_html__( '(e.g. Actors list)', 'custom-post-type-ui' ),
558
+ 'labeltext' => esc_html__( 'Items List', 'custom-post-type-ui' ),
559
+ 'helptext' => esc_attr__( 'Screen reader text for the items list heading on the term listing screen.', 'custom-post-type-ui' ),
560
+ ) );
561
+ ?>
562
+ </table>
563
+ </div>
564
+ </div>
565
+ </div>
566
+ <div class="cptui-section postbox">
567
+ <button type="button" class="handlediv button-link" aria-expanded="true">
568
+ <span class="screen-reader-text"><?php esc_html_e( 'Toggle panel: Settings', 'custom-post-type-ui' ); ?></span>
569
+ <span class="toggle-indicator" aria-hidden="true"></span>
570
+ </button>
571
+ <h2 class="hndle">
572
+ <span><?php esc_html_e( 'Settings', 'custom-post-type-ui' ); ?></span>
573
+ </h2>
574
+ <div class="inside">
575
+ <div class="main">
576
+ <table class="form-table cptui-table">
577
+ <?php
578
+
579
+ $select = array(
580
+ 'options' => array(
581
+ array( 'attr' => '0', 'text' => esc_attr__( 'False', 'custom-post-type-ui' ) ),
582
+ array(
583
+ 'attr' => '1',
584
+ 'text' => esc_attr__( 'True', 'custom-post-type-ui' ),
585
+ 'default' => 'true'
586
+ ),
587
+ ),
588
+ );
589
+ $selected = ( isset( $current ) ) ? disp_boolean( $current['public'] ) : '';
590
+ $select['selected'] = ( ! empty( $selected ) ) ? $current['public'] : '';
591
+ echo $ui->get_select_input( array(
592
+ 'namearray' => 'cpt_custom_tax',
593
+ 'name' => 'public',
594
+ 'labeltext' => esc_html__( 'Public', 'custom-post-type-ui' ),
595
+ 'aftertext' => esc_html__( '(default: true) Whether or not the taxonomy should be publicly queryable.', 'custom-post-type-ui' ),
596
+ 'selections' => $select,
597
+ ) );
598
+
599
+ $select = array(
600
+ 'options' => array(
601
+ array(
602
+ 'attr' => '0',
603
+ 'text' => esc_attr__( 'False', 'custom-post-type-ui' ),
604
+ 'default' => 'true'
605
+ ),
606
+ array( 'attr' => '1', 'text' => esc_attr__( 'True', 'custom-post-type-ui' ) ),
607
+ ),
608
+ );
609
+ $selected = ( isset( $current ) ) ? disp_boolean( $current['hierarchical'] ) : '';
610
+ $select['selected'] = ( ! empty( $selected ) ) ? $current['hierarchical'] : '';
611
+ echo $ui->get_select_input( array(
612
+ 'namearray' => 'cpt_custom_tax',
613
+ 'name' => 'hierarchical',
614
+ 'labeltext' => esc_html__( 'Hierarchical', 'custom-post-type-ui' ),
615
+ 'aftertext' => esc_html__( '(default: false) Whether the taxonomy can have parent-child relationships.', 'custom-post-type-ui' ),
616
+ 'selections' => $select,
617
+ ) );
618
+
619
+ $select = array(
620
+ 'options' => array(
621
+ array( 'attr' => '0', 'text' => esc_attr__( 'False', 'custom-post-type-ui' ) ),
622
+ array(
623
+ 'attr' => '1',
624
+ 'text' => esc_attr__( 'True', 'custom-post-type-ui' ),
625
+ 'default' => 'true'
626
+ ),
627
+ ),
628
+ );
629
+ $selected = ( isset( $current ) ) ? disp_boolean( $current['show_ui'] ) : '';
630
+ $select['selected'] = ( ! empty( $selected ) ) ? $current['show_ui'] : '';
631
+ echo $ui->get_select_input( array(
632
+ 'namearray' => 'cpt_custom_tax',
633
+ 'name' => 'show_ui',
634
+ 'labeltext' => esc_html__( 'Show UI', 'custom-post-type-ui' ),
635
+ 'aftertext' => esc_html__( '(default: true) Whether to generate a default UI for managing this custom taxonomy.', 'custom-post-type-ui' ),
636
+ 'selections' => $select,
637
+ ) );
638
+
639
+ $select = array(
640
+ 'options' => array(
641
+ array( 'attr' => '0', 'text' => esc_attr__( 'False', 'custom-post-type-ui' ) ),
642
+ array(
643
+ 'attr' => '1',
644
+ 'text' => esc_attr__( 'True', 'custom-post-type-ui' ),
645
+ 'default' => 'true'
646
+ ),
647
+ ),
648
+ );
649
+ $selected = ( isset( $current ) ) ? disp_boolean( $current['show_in_menu'] ) : '';
650
+ $select['selected'] = ( ! empty( $selected ) ) ? $current['show_in_menu'] : '';
651
+ echo $ui->get_select_input( array(
652
+ 'namearray' => 'cpt_custom_tax',
653
+ 'name' => 'show_in_menu',
654
+ 'labeltext' => esc_html__( 'Show in menu', 'custom-post-type-ui' ),
655
+ 'aftertext' => esc_html__( '(default: value of show_ui) Whether to show the taxonomy in the admin menu.', 'custom-post-type-ui' ),
656
+ 'selections' => $select,
657
+ ) );
658
+
659
+ $select = array(
660
+ 'options' => array(
661
+ array( 'attr' => '0', 'text' => esc_attr__( 'False', 'custom-post-type-ui' ) ),
662
+ array(
663
+ 'attr' => '1',
664
+ 'text' => esc_attr__( 'True', 'custom-post-type-ui' ),
665
+ 'default' => 'true'
666
+ ),
667
+ ),
668
+ );
669
+ $selected = ( isset( $current ) && ! empty( $current['show_in_nav_menus'] ) ) ? disp_boolean( $current['show_in_nav_menus'] ) : '';
670
+ $select['selected'] = ( ! empty( $selected ) ) ? $current['show_in_nav_menus'] : '';
671
+ echo $ui->get_select_input( array(
672
+ 'namearray' => 'cpt_custom_tax',
673
+ 'name' => 'show_in_nav_menus',
674
+ 'labeltext' => esc_html__( 'Show in nav menus', 'custom-post-type-ui' ),
675
+ 'aftertext' => esc_html__( '(default: value of public) Whether to make the taxonomy available for selection in navigation menus.', 'custom-post-type-ui' ),
676
+ 'selections' => $select,
677
+ ) );
678
+
679
+ $select = array(
680
+ 'options' => array(
681
+ array( 'attr' => '0', 'text' => esc_attr__( 'False', 'custom-post-type-ui' ) ),
682
+ array(
683
+ 'attr' => '1',
684
+ 'text' => esc_attr__( 'True', 'custom-post-type-ui' ),
685
+ 'default' => 'true'
686
+ ),
687
+ ),
688
+ );
689
+ $selected = ( isset( $current ) ) ? disp_boolean( $current['query_var'] ) : '';
690
+ $select['selected'] = ( ! empty( $selected ) ) ? $current['query_var'] : '';
691
+ echo $ui->get_select_input( array(
692
+ 'namearray' => 'cpt_custom_tax',
693
+ 'name' => 'query_var',
694
+ 'labeltext' => esc_html__( 'Query Var', 'custom-post-type-ui' ),
695
+ 'aftertext' => esc_html__( '(default: true) Sets the query_var key for this taxonomy.', 'custom-post-type-ui' ),
696
+ 'selections' => $select,
697
+ ) );
698
+
699
+ echo $ui->get_text_input( array(
700
+ 'namearray' => 'cpt_custom_tax',
701
+ 'name' => 'query_var_slug',
702
+ 'textvalue' => ( isset( $current['query_var_slug'] ) ) ? esc_attr( $current['query_var_slug'] ) : '',
703
+ 'aftertext' => esc_attr__( '(default: taxonomy slug). Query var needs to be true to use.', 'custom-post-type-ui' ),
704
+ 'labeltext' => esc_html__( 'Custom Query Var String', 'custom-post-type-ui' ),
705
+ 'helptext' => esc_html__( 'Sets a custom query_var slug for this taxonomy.', 'custom-post-type-ui' ),
706
+ ) );
707
+
708
+ $select = array(
709
+ 'options' => array(
710
+ array( 'attr' => '0', 'text' => esc_attr__( 'False', 'custom-post-type-ui' ) ),
711
+ array(
712
+ 'attr' => '1',
713
+ 'text' => esc_attr__( 'True', 'custom-post-type-ui' ),
714
+ 'default' => 'true'
715
+ ),
716
+ ),
717
+ );
718
+ $selected = ( isset( $current ) ) ? disp_boolean( $current['rewrite'] ) : '';
719
+ $select['selected'] = ( ! empty( $selected ) ) ? $current['rewrite'] : '';
720
+ echo $ui->get_select_input( array(
721
+ 'namearray' => 'cpt_custom_tax',
722
+ 'name' => 'rewrite',
723
+ 'labeltext' => esc_html__( 'Rewrite', 'custom-post-type-ui' ),
724
+ 'aftertext' => esc_html__( '(default: true) Whether or not WordPress should use rewrites for this taxonomy.', 'custom-post-type-ui' ),
725
+ 'selections' => $select,
726
+ ) );
727
+
728
+ echo $ui->get_text_input( array(
729
+ 'namearray' => 'cpt_custom_tax',
730
+ 'name' => 'rewrite_slug',
731
+ 'textvalue' => ( isset( $current['rewrite_slug'] ) ) ? esc_attr( $current['rewrite_slug'] ) : '',
732
+ 'aftertext' => esc_attr__( '(default: taxonomy name)', 'custom-post-type-ui' ),
733
+ 'labeltext' => esc_html__( 'Custom Rewrite Slug', 'custom-post-type-ui' ),
734
+ 'helptext' => esc_html__( 'Custom taxonomy rewrite slug.', 'custom-post-type-ui' ),
735
+ ) );
736
+
737
+ $select = array(
738
+ 'options' => array(
739
+ array( 'attr' => '0', 'text' => esc_attr__( 'False', 'custom-post-type-ui' ) ),
740
+ array(
741
+ 'attr' => '1',
742
+ 'text' => esc_attr__( 'True', 'custom-post-type-ui' ),
743
+ 'default' => 'true'
744
+ ),
745
+ ),
746
+ );
747
+ $selected = ( isset( $current ) ) ? disp_boolean( $current['rewrite_withfront'] ) : '';
748
+ $select['selected'] = ( ! empty( $selected ) ) ? $current['rewrite_withfront'] : '';
749
+ echo $ui->get_select_input( array(
750
+ 'namearray' => 'cpt_custom_tax',
751
+ 'name' => 'rewrite_withfront',
752
+ 'labeltext' => esc_html__( 'Rewrite With Front', 'custom-post-type-ui' ),
753
+ 'aftertext' => esc_html__( '(default: true) Should the permastruct be prepended with the front base.', 'custom-post-type-ui' ),
754
+ 'selections' => $select,
755
+ ) );
756
+
757
+ $select = array(
758
+ 'options' => array(
759
+ array(
760
+ 'attr' => '0',
761
+ 'text' => esc_attr__( 'False', 'custom-post-type-ui' ),
762
+ 'default' => 'false'
763
+ ),
764
+ array( 'attr' => '1', 'text' => esc_attr__( 'True', 'custom-post-type-ui' ) ),
765
+ ),
766
+ );
767
+ $selected = ( isset( $current ) ) ? disp_boolean( $current['rewrite_hierarchical'] ) : '';
768
+ $select['selected'] = ( ! empty( $selected ) ) ? $current['rewrite_hierarchical'] : '';
769
+ echo $ui->get_select_input( array(
770
+ 'namearray' => 'cpt_custom_tax',
771
+ 'name' => 'rewrite_hierarchical',
772
+ 'labeltext' => esc_html__( 'Rewrite Hierarchical', 'custom-post-type-ui' ),
773
+ 'aftertext' => esc_html__( '(default: false) Should the permastruct allow hierarchical urls.', 'custom-post-type-ui' ),
774
+ 'selections' => $select,
775
+ ) );
776
+
777
+ $select = array(
778
+ 'options' => array(
779
+ array(
780
+ 'attr' => '0',
781
+ 'text' => esc_attr__( 'False', 'custom-post-type-ui' ),
782
+ 'default' => 'true'
783
+ ),
784
+ array( 'attr' => '1', 'text' => esc_attr__( 'True', 'custom-post-type-ui' ) ),
785
+ ),
786
+ );
787
+ $selected = ( isset( $current ) ) ? disp_boolean( $current['show_admin_column'] ) : '';
788
+ $select['selected'] = ( ! empty( $selected ) ) ? $current['show_admin_column'] : '';
789
+ echo $ui->get_select_input( array(
790
+ 'namearray' => 'cpt_custom_tax',
791
+ 'name' => 'show_admin_column',
792
+ 'labeltext' => esc_html__( 'Show Admin Column', 'custom-post-type-ui' ),
793
+ 'aftertext' => esc_html__( '(default: false) Whether to allow automatic creation of taxonomy columns on associated post-types.', 'custom-post-type-ui' ),
794
+ 'selections' => $select,
795
+ ) );
796
+
797
+ $select = array(
798
+ 'options' => array(
799
+ array(
800
+ 'attr' => '0',
801
+ 'text' => esc_attr__( 'False', 'custom-post-type-ui' ),
802
+ 'default' => 'false'
803
+ ),
804
+ array( 'attr' => '1', 'text' => esc_attr__( 'True', 'custom-post-type-ui' ) ),
805
+ ),
806
+ );
807
+ $selected = ( isset( $current ) ) ? disp_boolean( $current['show_in_rest'] ) : '';
808
+ $select['selected'] = ( ! empty( $selected ) ) ? $current['show_in_rest'] : '';
809
+ echo $ui->get_select_input( array(
810
+ 'namearray' => 'cpt_custom_tax',
811
+ 'name' => 'show_in_rest',
812
+ 'labeltext' => esc_html__( 'Show in REST API', 'custom-post-type-ui' ),
813
+ 'aftertext' => esc_html__( '(default: false) Whether to show this taxonomy data in the WP REST API.', 'custom-post-type-ui' ),
814
+ 'selections' => $select,
815
+ ) );
816
+
817
+ echo $ui->get_text_input( array(
818
+ 'namearray' => 'cpt_custom_tax',
819
+ 'name' => 'rest_base',
820
+ 'labeltext' => esc_html__( 'REST API base slug', 'custom-post-type-ui' ),
821
+ 'helptext' => esc_attr__( 'Slug to use in REST API URLs.', 'custom-post-type-ui' ),
822
+ 'textvalue' => ( isset( $current['rest_base'] ) ) ? esc_attr( $current['rest_base'] ) : '',
823
+ ) );
824
+
825
+ $select = array(
826
+ 'options' => array(
827
+ array(
828
+ 'attr' => '0',
829
+ 'text' => esc_attr__( 'False', 'custom-post-type-ui' ),
830
+ 'default' => 'false'
831
+ ),
832
+ array( 'attr' => '1', 'text' => esc_attr__( 'True', 'custom-post-type-ui' ) ),
833
+ ),
834
+ );
835
+ $selected = ( isset( $current ) && ! empty( $current['show_in_quick_edit'] ) ) ? disp_boolean( $current['show_in_quick_edit'] ) : '';
836
+ $select['selected'] = ( ! empty( $selected ) ) ? $current['show_in_quick_edit'] : '';
837
+ echo $ui->get_select_input( array(
838
+ 'namearray' => 'cpt_custom_tax',
839
+ 'name' => 'show_in_quick_edit',
840
+ 'labeltext' => esc_html__( 'Show in quick/bulk edit panel.', 'custom-post-type-ui' ),
841
+ 'aftertext' => esc_html__( '(default: false) Whether to show the taxonomy in the quick/bulk edit panel.', 'custom-post-type-ui' ),
842
+ 'selections' => $select,
843
+ ) );
844
+ ?>
845
+ </table>
846
+ </div>
847
+ </div>
848
+ </div>
849
 
850
+ <?php
851
+ /**
852
+ * Fires after the default fieldsets on the taxonomy screen.
853
+ *
854
+ * @since 1.3.0
855
+ *
856
+ * @param cptui_admin_ui $ui Admin UI instance.
857
+ */
858
+ do_action( 'cptui_taxonomy_after_fieldsets', $ui ); ?>
859
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
860
  <p class="submit">
861
  <?php wp_nonce_field( 'cptui_addedit_taxonomy_nonce_action', 'cptui_addedit_taxonomy_nonce_field' );
862
  if ( ! empty( $_GET ) && ! empty( $_GET['action'] ) && 'edit' == $_GET['action'] ) { ?>
870
  * @param string $value Text to use for the button.
871
  */
872
  ?>
873
+ <input type="submit" class="button-primary cptui-taxonomy-submit" name="cpt_submit" value="<?php echo esc_attr( apply_filters( 'cptui_taxonomy_submit_edit', esc_attr__( 'Save Taxonomy', 'custom-post-type-ui' ) ) ); ?>" />
874
  <?php
875
 
876
  /**
881
  * @param string $value Text to use for the button.
882
  */
883
  ?>
884
+ <input type="submit" class="button-secondary" name="cpt_delete" id="cpt_submit_delete" value="<?php echo esc_attr( apply_filters( 'cptui_taxonomy_submit_delete', __( 'Delete Taxonomy', 'custom-post-type-ui' ) ) ); ?>" />
885
  <?php } else { ?>
886
  <?php
887
 
893
  * @param string $value Text to use for the button.
894
  */
895
  ?>
896
+ <input type="submit" class="button-primary" name="cpt_submit" value="<?php echo esc_attr( apply_filters( 'cptui_taxonomy_submit_add', esc_attr__( 'Add Taxonomy', 'custom-post-type-ui' ) ) ); ?>" />
897
  <?php } ?>
898
 
899
  <?php if ( ! empty( $current ) ) { ?>
900
  <input type="hidden" name="tax_original" id="tax_original" value="<?php echo $current['name']; ?>" />
901
  <?php }
902
 
903
+ // Used to check and see if we should prevent duplicate slugs. ?>
904
  <input type="hidden" name="cpt_tax_status" id="cpt_tax_status" value="<?php echo $tab; ?>" />
905
  </p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
906
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
907
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
908
  </form>
909
  </div><!-- End .wrap -->
910
  <?php
916
  * @since 1.0.0
917
  *
918
  * @param array $taxonomies Array of taxonomies that are registered.
 
919
  */
920
  function cptui_taxonomies_dropdown( $taxonomies = array() ) {
921
 
922
  $ui = new cptui_admin_ui();
923
 
924
+ if ( ! empty( $taxonomies ) ) {
925
  $select = array();
926
  $select['options'] = array();
927
 
928
+ foreach ( $taxonomies as $tax ) {
929
  $text = ( ! empty( $tax['label'] ) ) ? $tax['label'] : $tax['name'];
930
  $select['options'][] = array( 'attr' => $tax['name'], 'text' => $text );
931
  }
937
  'namearray' => 'cptui_selected_taxonomy',
938
  'name' => 'taxonomy',
939
  'selections' => $select,
940
+ 'wrap' => false,
941
  ) );
942
  }
943
  }
956
 
957
  $tax = false;
958
 
959
+ if ( ! empty( $_POST ) ) {
960
  if ( isset( $_POST['cptui_selected_taxonomy']['taxonomy'] ) ) {
961
  $tax = sanitize_text_field( $_POST['cptui_selected_taxonomy']['taxonomy'] );
962
+ } else if ( $taxonomy_deleted ) {
 
 
963
  $taxonomies = cptui_get_taxonomy_data();
964
  $tax = key( $taxonomies );
965
+ } else if ( isset( $_POST['cpt_custom_tax']['name'] ) ) {
 
 
966
  $tax = sanitize_text_field( $_POST['cpt_custom_tax']['name'] );
967
  }
968
+ } else if ( ! empty( $_GET ) && isset( $_GET['cptui_taxonomy'] ) ) {
969
  $tax = sanitize_text_field( $_GET['cptui_taxonomy'] );
970
  } else {
971
  $taxonomies = cptui_get_taxonomy_data();
972
+ if ( ! empty( $taxonomies ) ) {
973
  // Will return the first array key.
974
  $tax = key( $taxonomies );
975
  }
992
  *
993
  * @internal
994
  *
995
+ * @param array $data The $_POST values.
996
  * @return bool|string False on failure, string on success.
997
  */
998
  function cptui_delete_taxonomy( $data = array() ) {
1000
  if ( is_string( $data ) && taxonomy_exists( $data ) ) {
1001
  $data = array(
1002
  'cpt_custom_tax' => array(
1003
+ 'name' => $data,
1004
+ ),
1005
  );
1006
  }
1007
 
1008
  // Check if they selected one to delete.
1009
  if ( empty( $data['cpt_custom_tax']['name'] ) ) {
1010
+ return cptui_admin_notices( 'error', '', false, esc_html__( 'Please provide a taxonomy to delete', 'custom-post-type-ui' ) );
1011
  }
1012
 
1013
  /**
1052
  set_transient( 'cptui_flush_rewrite_rules', 'true', 5 * 60 );
1053
 
1054
  if ( isset( $success ) ) {
1055
+ return 'delete_success';
1056
  }
1057
+ return 'delete_fail';
1058
  }
1059
 
1060
  /**
1080
 
1081
  // They need to provide a name.
1082
  if ( empty( $data['cpt_custom_tax']['name'] ) ) {
1083
+ return cptui_admin_notices( 'error', '', false, esc_html__( 'Please provide a taxonomy name', 'custom-post-type-ui' ) );
1084
  }
1085
 
1086
  if ( empty( $data['cpt_post_types'] ) ) {
1087
+ return cptui_admin_notices( 'error', '', false, esc_html__( 'Please provide a post type to attach to.', 'custom-post-type-ui' ) );
1088
  }
1089
 
1090
  if ( ! empty( $data['tax_original'] ) && $data['tax_original'] != $data['cpt_custom_tax']['name'] ) {
1093
  }
1094
  }
1095
 
1096
+ foreach ( $data as $key => $value ) {
1097
  if ( is_string( $value ) ) {
1098
  $data[ $key ] = sanitize_text_field( $value );
1099
  } else {
1106
  false !== strpos( $data['cpt_custom_tax']['rewrite_slug'], '\'' ) ||
1107
  false !== strpos( $data['cpt_custom_tax']['rewrite_slug'], '\"' ) ) {
1108
 
1109
+ add_filter( 'cptui_custom_error_message', 'cptui_slug_has_quotes' );
1110
+ return 'error';
1111
  }
1112
 
1113
  $taxonomies = cptui_get_taxonomy_data();
1124
  $slug_exists = apply_filters( 'cptui_taxonomy_slug_exists', false, $data['cpt_custom_tax']['name'], $taxonomies );
1125
  if ( 'new' == $data['cpt_tax_status'] ) {
1126
  if ( true === $slug_exists ) {
1127
+ add_filter( 'cptui_custom_error_message', 'cptui_slug_matches_taxonomy' );
1128
+ return 'error';
1129
  }
1130
  }
1131
 
1132
+ foreach ( $data['cpt_tax_labels'] as $key => $label ) {
1133
  if ( empty( $label ) ) {
1134
  unset( $data['cpt_tax_labels'][ $key ] );
1135
  }
1166
  'public' => disp_boolean( $data['cpt_custom_tax']['public'] ),
1167
  'hierarchical' => disp_boolean( $data['cpt_custom_tax']['hierarchical'] ),
1168
  'show_ui' => disp_boolean( $data['cpt_custom_tax']['show_ui'] ),
1169
+ 'show_in_menu' => disp_boolean( $data['cpt_custom_tax']['show_in_menu'] ),
1170
+ 'show_in_nav_menus' => disp_boolean( $data['cpt_custom_tax']['show_in_nav_menus'] ),
1171
  'query_var' => disp_boolean( $data['cpt_custom_tax']['query_var'] ),
1172
  'query_var_slug' => $query_var_slug,
1173
  'rewrite' => disp_boolean( $data['cpt_custom_tax']['rewrite'] ),
1178
  'show_in_rest' => disp_boolean( $data['cpt_custom_tax']['show_in_rest'] ),
1179
  'show_in_quick_edit' => $show_quickpanel_bulk,
1180
  'rest_base' => $rest_base,
1181
+ 'labels' => $data['cpt_tax_labels'],
1182
  );
1183
 
1184
  $taxonomies[ $data['cpt_custom_tax']['name'] ]['object_types'] = $data['cpt_post_types'];
1210
 
1211
  if ( isset( $success ) ) {
1212
  if ( 'new' == $data['cpt_tax_status'] ) {
1213
+ return 'add_success';
1214
  }
1215
  }
1216
 
1217
+ return 'update_success';
1218
  }
1219
 
1220
  /**
1397
  return $slug_exists;
1398
  }
1399
  add_filter( 'cptui_taxonomy_slug_exists', 'cptui_check_existing_taxonomy_slugs', 10, 3 );
1400
+
1401
+ /**
1402
+ * Handle the save and deletion of taxonomy data.
1403
+ *
1404
+ * @since 1.4.0
1405
+ */
1406
+ function cptui_process_taxonomy() {
1407
+
1408
+ if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
1409
+ return;
1410
+ }
1411
+
1412
+ if ( ! is_admin() ) {
1413
+ return;
1414
+ }
1415
+
1416
+ if ( ! empty( $_GET ) && isset( $_GET['page'] ) && 'cptui_manage_taxonomies' !== $_GET['page'] ) {
1417
+ return;
1418
+ }
1419
+
1420
+ if ( ! empty( $_POST ) ) {
1421
+ $result = '';
1422
+ if ( isset( $_POST['cpt_submit'] ) ) {
1423
+ check_admin_referer( 'cptui_addedit_taxonomy_nonce_action', 'cptui_addedit_taxonomy_nonce_field' );
1424
+ $result = cptui_update_taxonomy( $_POST );
1425
+ } elseif ( isset( $_POST['cpt_delete'] ) ) {
1426
+ check_admin_referer( 'cptui_addedit_taxonomy_nonce_action', 'cptui_addedit_taxonomy_nonce_field' );
1427
+ $result = cptui_delete_taxonomy( $_POST );
1428
+ add_filter( 'cptui_taxonomy_deleted', '__return_true' );
1429
+ }
1430
+ if ( $result ) {
1431
+ add_action( 'admin_notices', "cptui_{$result}_admin_notice" );
1432
+ }
1433
+ }
1434
+ }
1435
+ add_action( 'init', 'cptui_process_taxonomy', 8 );
inc/utility.php CHANGED
@@ -43,7 +43,7 @@ add_filter( 'plugin_action_links_' . plugin_basename( dirname( dirname( __FILE__
43
  * @return string
44
  */
45
  function cptui_menu_icon() {
46
- return 'data:image/svg;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAABC9pVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMDE0IDc5LjE1Njc5NywgMjAxNC8wOC8yMC0wOTo1MzowMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wUmlnaHRzPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvcmlnaHRzLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIgeG1wUmlnaHRzOk1hcmtlZD0iVHJ1ZSIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo5NkE3NTc5MUJCOTIxMUU0QUVENDlFMUYwOEMyRDgwQyIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDo5NkE3NTc5MEJCOTIxMUU0QUVENDlFMUYwOEMyRDgwQyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ0MgMjAxNCAoV2luZG93cykiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmRpZDo5NjMzOTU2ODgyMjhFMDExOTg5Q0MwQTFBRDAyQjVDMiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDo5NjMzOTU2ODgyMjhFMDExOTg5Q0MwQTFBRDAyQjVDMiIvPiA8ZGM6cmlnaHRzPiA8cmRmOkFsdD4gPHJkZjpsaSB4bWw6bGFuZz0ieC1kZWZhdWx0Ij5DcmVhdGl2ZSBDb21tb25zIEF0dHJpYnV0aW9uIE5vbi1Db21tZXJjaWFsIE5vIERlcml2YXRpdmVzPC9yZGY6bGk+IDwvcmRmOkFsdD4gPC9kYzpyaWdodHM+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+hXhu9wAAAjdJREFUeNrcWYFtwjAQBNQB0g3oBukEDRPUnYCwQRmhE8AGhgnKBh0h2YBuQDZIbclI6GXH7/c7cfrSCxEcuHv+7x3/su/7xZxttZi5/XsChfJP5Y3ynskFKwNdAw4Xym89r9UDv0dy1wd1z2/s4F0ERGbgC+WN8iuGQJFZ2tzB303ANbCIa1O4XLZTfiLeq3H8KC8frr3BRU/g/dbzpRflZ+Wd8ta8pjAbeG2VT4VGL0JE2kArXClUeCJ/GqEvuSL/aGtKJz5nAv5oUtdKYCifuwzAa+Bf8OIS7EZdW9PnCQoWBnADox+SQhjwtQcEFby2vQ18iAr5lEOadboJlkxqczcZspWgEJBgLYYEFnwDZZObgHSsHyKBBY/6N2MISEL0sODRjZNK4IAEocGuzT1lAHiJ7dxYGV0CtZEJe0JrJBMl2xQCN+YdK0rvHSYoD/WXhNHfB4DXmfBNrQGZ4KlNBuxYaxcwThUKsYYCPpZAiCT69H5NAR9LgIuEoILnIBBL4hCQOlajyGjMrhLq/WvIGVzKs9FQ/dbrP3I73A0hoY9bfnM8ncaQOHI2Q64awNZEaN6PVgOYf4It78cacEASG668HyOFUlhUClUTg69iU6hYZGpYAtuJcb5jZ2Q5nE5DL4eGLrCIG89+Zqz5QPUQ+aGhSwsJ6JHqYUZj4j0koJlecy5a0GdeVpaLu5lEX+PsVo48380A/MWmQqkn9RzPz2LoZM7WwGrTB8oJI94a9TtB5fsTYABOp6Z0XZr87gAAAABJRU5ErkJggg==';
47
  }
48
 
49
  /**
@@ -168,7 +168,7 @@ function cptui_get_current_action() {
168
  */
169
  function cptui_get_post_type_slugs() {
170
  $post_types = get_option( 'cptui_post_types' );
171
- if ( ! empty ( $post_types ) ) {
172
  return array_keys( $post_types );
173
  }
174
  return array();
@@ -183,7 +183,7 @@ function cptui_get_post_type_slugs() {
183
  */
184
  function cptui_get_taxonomy_slugs() {
185
  $taxonomies = get_option( 'cptui_taxonomies' );
186
- if ( ! empty ( $taxonomies ) ) {
187
  return array_keys( $taxonomies );
188
  }
189
  return array();
@@ -194,7 +194,7 @@ function cptui_get_taxonomy_slugs() {
194
  *
195
  * @since 1.3.0
196
  *
197
- * @param $path
198
  * @return string|void
199
  */
200
  function cptui_admin_url( $path ) {
@@ -227,7 +227,7 @@ function cptui_get_post_form_action( $ui = '' ) {
227
  *
228
  * @since 1.3.0
229
  *
230
- * @param object $ui CPTUI Admin UI instance
231
  */
232
  function cptui_post_form_action( $ui ) {
233
  echo cptui_get_post_form_action( $ui );
@@ -260,7 +260,7 @@ function cptui_get_taxonomy_data() {
260
  *
261
  * @since 1.3.0
262
  *
263
- * @param string $slug Post type slug to check
264
  * @param array|string $data Post type data being utilized.
265
  * @return mixed|void
266
  */
@@ -295,7 +295,6 @@ function cptui_products_sidebar() {
295
  $ads = cptui_get_ads();
296
  if ( ! empty( $ads ) ) {
297
  foreach ( $ads as $ad ) {
298
-
299
  $the_ad = sprintf(
300
  '<img src="%s" alt="%s">',
301
  esc_attr( $ad['image'] ),
@@ -309,6 +308,11 @@ function cptui_products_sidebar() {
309
  $the_ad
310
  );
311
  }
 
 
 
 
 
312
  }
313
  echo '</div>';
314
 
@@ -332,7 +336,7 @@ function cptui_newsletter_form() {
332
  <p><strong><?php esc_html_e( 'Get email updates from pluginize.com about Custom Post Type UI', 'custom-post-type-ui' ); ?></strong></p>
333
  <div class="mc-field-group">
334
  <label for="mce-EMAIL"><?php esc_html_e( 'Email Address', 'custom-post-type-ui' ); ?></label>
335
- <input type="email" value="" name="EMAIL" class="required email" id="mce-EMAIL">
336
  </div>
337
  <div id="mce-responses" class="clear">
338
  <div class="response" id="mce-error-response" style="display:none"></div>
@@ -341,7 +345,7 @@ function cptui_newsletter_form() {
341
  <div style="position: absolute; left: -5000px;" aria-hidden="true">
342
  <input type="text" name="b_67169b098c99de702c897d63e_9cb1c7472e" tabindex="-1" value=""></div>
343
  <div class="clear">
344
- <input type="submit" value="<?php esc_attr_e( 'Subscribe', 'custom-post-type-ui' ); ?>" name="subscribe" id="mc-embedded-subscribe" class="button">
345
  </div>
346
  </div>
347
  </form>
@@ -414,3 +418,220 @@ function cptui_default_ads( $ads = array() ) {
414
  return $ads;
415
  }
416
  add_filter( 'cptui_ads', 'cptui_default_ads' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  * @return string
44
  */
45
  function cptui_menu_icon() {
46
+ return 'dashicons-forms';
47
  }
48
 
49
  /**
168
  */
169
  function cptui_get_post_type_slugs() {
170
  $post_types = get_option( 'cptui_post_types' );
171
+ if ( ! empty( $post_types ) ) {
172
  return array_keys( $post_types );
173
  }
174
  return array();
183
  */
184
  function cptui_get_taxonomy_slugs() {
185
  $taxonomies = get_option( 'cptui_taxonomies' );
186
+ if ( ! empty( $taxonomies ) ) {
187
  return array_keys( $taxonomies );
188
  }
189
  return array();
194
  *
195
  * @since 1.3.0
196
  *
197
+ * @param string $path URL path.
198
  * @return string|void
199
  */
200
  function cptui_admin_url( $path ) {
227
  *
228
  * @since 1.3.0
229
  *
230
+ * @param object $ui CPTUI Admin UI instance.
231
  */
232
  function cptui_post_form_action( $ui ) {
233
  echo cptui_get_post_form_action( $ui );
260
  *
261
  * @since 1.3.0
262
  *
263
+ * @param string $slug Post type slug to check.
264
  * @param array|string $data Post type data being utilized.
265
  * @return mixed|void
266
  */
295
  $ads = cptui_get_ads();
296
  if ( ! empty( $ads ) ) {
297
  foreach ( $ads as $ad ) {
 
298
  $the_ad = sprintf(
299
  '<img src="%s" alt="%s">',
300
  esc_attr( $ad['image'] ),
308
  $the_ad
309
  );
310
  }
311
+ printf(
312
+ '<p><a href="%s">%s</a></p>',
313
+ 'https://pluginize.com/product/custom-post-type-ui-extended/?utm_source=remove_ads&utm_medium=text&utm_campaign=cptui',
314
+ esc_html__( 'Remove these ads?', 'custom-post-type-ui' )
315
+ );
316
  }
317
  echo '</div>';
318
 
336
  <p><strong><?php esc_html_e( 'Get email updates from pluginize.com about Custom Post Type UI', 'custom-post-type-ui' ); ?></strong></p>
337
  <div class="mc-field-group">
338
  <label for="mce-EMAIL"><?php esc_html_e( 'Email Address', 'custom-post-type-ui' ); ?></label>
339
+ <input tabindex="-1" type="email" value="" name="EMAIL" class="required email" id="mce-EMAIL">
340
  </div>
341
  <div id="mce-responses" class="clear">
342
  <div class="response" id="mce-error-response" style="display:none"></div>
345
  <div style="position: absolute; left: -5000px;" aria-hidden="true">
346
  <input type="text" name="b_67169b098c99de702c897d63e_9cb1c7472e" tabindex="-1" value=""></div>
347
  <div class="clear">
348
+ <input type="submit" value="<?php esc_attr_e( 'Subscribe', 'custom-post-type-ui' ); ?>" name="subscribe" id="mc-embedded-subscribe" class="button" tabindex="-1">
349
  </div>
350
  </div>
351
  </form>
418
  return $ads;
419
  }
420
  add_filter( 'cptui_ads', 'cptui_default_ads' );
421
+
422
+ /**
423
+ * Secondary admin notices function for use with admin_notices hook.
424
+ *
425
+ * Constructs admin notice HTML.
426
+ *
427
+ * @since 1.4.0
428
+ *
429
+ * @param string $message Message to use in admin notice.
430
+ * @param bool $success Whether or not a success.
431
+ *
432
+ * @return mixed|void
433
+ */
434
+ function cptui_admin_notices_helper( $message = '', $success = true ) {
435
+
436
+ $class = array();
437
+ $class[] = ( $success ) ? 'updated' : 'error';
438
+ $class[] = 'notice is-dismissible';
439
+
440
+ $messagewrapstart = '<div id="message" class="' . implode( ' ', $class ) . '"><p>';
441
+
442
+ $messagewrapend = '</p></div>';
443
+
444
+ $action = '';
445
+
446
+ /**
447
+ * Filters the custom admin notice for CPTUI.
448
+ *
449
+ * @since 1.0.0
450
+ *
451
+ * @param string $value Complete HTML output for notice.
452
+ * @param string $action Action whose message is being generated.
453
+ * @param string $message The message to be displayed.
454
+ * @param string $messagewrapstart Beginning wrap HTML.
455
+ * @param string $messagewrapend Ending wrap HTML.
456
+ */
457
+ return apply_filters( 'cptui_admin_notice', $messagewrapstart . $message . $messagewrapend, $action, $message, $messagewrapstart, $messagewrapend );
458
+ }
459
+
460
+ /**
461
+ * Grab post type or taxonomy slug from $_POST global, if available.
462
+ *
463
+ * @since 1.4.0
464
+ *
465
+ * @internal
466
+ *
467
+ * @return string
468
+ */
469
+ function cptui_get_object_from_post_global() {
470
+ if ( isset( $_POST['cpt_custom_post_type']['name'] ) ) {
471
+ return sanitize_text_field( $_POST['cpt_custom_post_type']['name'] );
472
+ }
473
+
474
+ if ( isset( $_POST['cpt_custom_tax']['name'] ) ) {
475
+ return sanitize_text_field( $_POST['cpt_custom_tax']['name'] );
476
+ }
477
+
478
+ return esc_html__( 'Object', 'custom-post-type-ui' );
479
+ }
480
+
481
+ /**
482
+ * Successful add callback.
483
+ *
484
+ * @since 1.4.0
485
+ */
486
+ function cptui_add_success_admin_notice() {
487
+ echo cptui_admin_notices_helper(
488
+ sprintf(
489
+ esc_html__( '%s has been successfully added', 'custom-post-type-ui' ),
490
+ cptui_get_object_from_post_global()
491
+ ),
492
+ true
493
+ );
494
+ }
495
+
496
+ /**
497
+ * Fail to add callback.
498
+ *
499
+ * @since 1.4.0
500
+ */
501
+ function cptui_add_fail_admin_notice() {
502
+ echo cptui_admin_notices_helper(
503
+ sprintf(
504
+ esc_html__( '%s has failed to be added', 'custom-post-type-ui' ),
505
+ cptui_get_object_from_post_global()
506
+ ),
507
+ false
508
+ );
509
+ }
510
+
511
+ /**
512
+ * Successful update callback.
513
+ *
514
+ * @since 1.4.0
515
+ */
516
+ function cptui_update_success_admin_notice() {
517
+ echo cptui_admin_notices_helper(
518
+ sprintf(
519
+ esc_html__( '%s has been successfully updated', 'custom-post-type-ui' ),
520
+ cptui_get_object_from_post_global()
521
+ ),
522
+ true
523
+ );
524
+ }
525
+
526
+ /**
527
+ * Fail to update callback.
528
+ *
529
+ * @since 1.4.0
530
+ */
531
+ function cptui_update_fail_admin_notice() {
532
+ echo cptui_admin_notices_helper(
533
+ sprintf(
534
+ esc_html__( '%s has failed to be updated', 'custom-post-type-ui' ),
535
+ cptui_get_object_from_post_global()
536
+ ),
537
+ false
538
+ );
539
+ }
540
+
541
+ /**
542
+ * Successful delete callback.
543
+ *
544
+ * @since 1.4.0
545
+ */
546
+ function cptui_delete_success_admin_notice() {
547
+ echo cptui_admin_notices_helper(
548
+ sprintf(
549
+ esc_html__( '%s has been successfully deleted', 'custom-post-type-ui' ),
550
+ cptui_get_object_from_post_global()
551
+ ),
552
+ true
553
+ );
554
+ }
555
+
556
+ /**
557
+ * Fail to delete callback.
558
+ *
559
+ * @since 1.4.0
560
+ */
561
+ function cptui_delete_fail_admin_notice() {
562
+ echo cptui_admin_notices_helper(
563
+ sprintf(
564
+ esc_html__( '%s has failed to be deleted', 'custom-post-type-ui' ),
565
+ cptui_get_object_from_post_global()
566
+ ),
567
+ false
568
+ );
569
+ }
570
+
571
+ /**
572
+ * Returns error message for if trying to register existing post type.
573
+ *
574
+ * @since 1.4.0
575
+ *
576
+ * @return string
577
+ */
578
+ function cptui_slug_matches_post_type() {
579
+ return sprintf(
580
+ esc_html__( 'Please choose a different post type name. %s is already registered.', 'custom-post-type-ui' ),
581
+ cptui_get_object_from_post_global()
582
+ );
583
+ }
584
+
585
+ /**
586
+ * Returns error message for if trying to register existing taxonomy.
587
+ *
588
+ * @since 1.4.0
589
+ *
590
+ * @return string
591
+ */
592
+ function cptui_slug_matches_taxonomy() {
593
+ return sprintf(
594
+ esc_html__( 'Please choose a different taxonomy name. %s is already registered.', 'custom-post-type-ui' ),
595
+ cptui_get_object_from_post_global()
596
+ );
597
+ }
598
+
599
+ /**
600
+ * Returns error message for if trying to register post type with matching page slug.
601
+ *
602
+ * @since 1.4.0
603
+ *
604
+ * @return string
605
+ */
606
+ function cptui_slug_matches_page() {
607
+ return sprintf(
608
+ esc_html__( 'Please choose a different post type name. %s matches an existing page slug, which can cause conflicts.', 'custom-post-type-ui' ),
609
+ cptui_get_object_from_post_global()
610
+ );
611
+ }
612
+
613
+ /**
614
+ * Returns error message for if trying to use quotes in slugs or rewrite slugs.
615
+ *
616
+ * @since 1.4.0
617
+ *
618
+ * @return string
619
+ */
620
+ function cptui_slug_has_quotes() {
621
+ return sprintf(
622
+ esc_html__( 'Please do not use quotes in post type/taxonomy names or rewrite slugs', 'custom-post-type-ui' ),
623
+ cptui_get_object_from_post_global()
624
+ );
625
+ }
626
+
627
+ /**
628
+ * Error admin notice.
629
+ *
630
+ * @since 1.4.0
631
+ */
632
+ function cptui_error_admin_notice() {
633
+ echo cptui_admin_notices_helper(
634
+ apply_filters( 'cptui_custom_error_message', '' ),
635
+ false
636
+ );
637
+ }
js/cptui.js CHANGED
@@ -1,5 +1,18 @@
 
 
 
 
 
 
 
 
1
  (function($) {
2
 
 
 
 
 
 
3
  // Switch to newly selected post type or taxonomy automatically.
4
  $('#post_type').on('change',function(){
5
  $('#cptui_select_post_type').submit();
@@ -11,7 +24,7 @@
11
 
12
  // Confirm our deletions
13
  $('#cpt_submit_delete').on('click',function() {
14
- if( confirm( cptui_type_data.confirm ) ) {
15
  return true;
16
  }
17
  return false;
@@ -40,7 +53,18 @@
40
  value = value.replace(/ /g, "_");
41
  value = value.toLowerCase();
42
  value = replaceDiacritics(value);
 
43
  $(this).attr('value',value);
 
 
 
 
 
 
 
 
 
 
44
  });
45
 
46
  // Replace diacritic characters with latin characters.
@@ -52,7 +76,7 @@
52
  /[\322-\330]/g, /[\362-\370]/g, // O, o
53
  /[\331-\334]/g, /[\371-\374]/g, // U, u
54
  /[\321]/g, /[\361]/g, // N, n
55
- /[\307]/g, /[\347]/g, // C, c
56
  ];
57
 
58
  var chars = ['A', 'a', 'E', 'e', 'I', 'i', 'O', 'o', 'U', 'u', 'N', 'n', 'C', 'c'];
@@ -64,11 +88,28 @@
64
  return s;
65
  }
66
 
 
 
 
 
 
 
 
67
  if ( undefined != wp.media ) {
68
  var _custom_media = true,
69
  _orig_send_attachment = wp.media.editor.send.attachment;
70
  }
71
 
 
 
 
 
 
 
 
 
 
 
72
  $('#cptui_choose_icon').on('click',function(e){
73
  e.preventDefault();
74
 
@@ -80,8 +121,8 @@
80
  $("#" + id).val(attachment.url);
81
  } else {
82
  return _orig_send_attachment.apply(this, [props, attachment]);
83
- };
84
- }
85
 
86
  wp.media.editor.open(button);
87
  return false;
@@ -106,4 +147,11 @@
106
  $('.cptui-help').on('click',function(e){
107
  e.preventDefault();
108
  });
 
 
 
 
 
 
 
109
  })(jQuery);
1
+ /**
2
+ * Add collapseable boxes to our editor screens.
3
+ */
4
+ postboxes.add_postbox_toggles(pagenow);
5
+
6
+ /**
7
+ * The rest of our customizations.
8
+ */
9
  (function($) {
10
 
11
+ if ('edit' === getParameterByName('action')) {
12
+ // Store our original slug on page load for edit checking.
13
+ var original_slug = $('#name').val();
14
+ }
15
+
16
  // Switch to newly selected post type or taxonomy automatically.
17
  $('#post_type').on('change',function(){
18
  $('#cptui_select_post_type').submit();
24
 
25
  // Confirm our deletions
26
  $('#cpt_submit_delete').on('click',function() {
27
+ if ( confirm( cptui_type_data.confirm ) ) {
28
  return true;
29
  }
30
  return false;
53
  value = value.replace(/ /g, "_");
54
  value = value.toLowerCase();
55
  value = replaceDiacritics(value);
56
+ value = replaceSpecialCharacters(value);
57
  $(this).attr('value',value);
58
+
59
+ //Displays a message if slug changes.
60
+ if(undefined != original_slug) {
61
+ var $slugchanged = $('#slugchanged');
62
+ if(value != original_slug) {
63
+ $slugchanged.removeClass('hidemessage');
64
+ } else {
65
+ $slugchanged.addClass('hidemessage');
66
+ }
67
+ }
68
  });
69
 
70
  // Replace diacritic characters with latin characters.
76
  /[\322-\330]/g, /[\362-\370]/g, // O, o
77
  /[\331-\334]/g, /[\371-\374]/g, // U, u
78
  /[\321]/g, /[\361]/g, // N, n
79
+ /[\307]/g, /[\347]/g // C, c
80
  ];
81
 
82
  var chars = ['A', 'a', 'E', 'e', 'I', 'i', 'O', 'o', 'U', 'u', 'N', 'n', 'C', 'c'];
88
  return s;
89
  }
90
 
91
+ function replaceSpecialCharacters(s) {
92
+
93
+ s = s.replace(/[^a-z0-9\s]/gi, '_');
94
+
95
+ return s;
96
+ }
97
+
98
  if ( undefined != wp.media ) {
99
  var _custom_media = true,
100
  _orig_send_attachment = wp.media.editor.send.attachment;
101
  }
102
 
103
+ function getParameterByName(name, url) {
104
+ if (!url) url = window.location.href;
105
+ name = name.replace(/[\[\]]/g, "\\$&");
106
+ var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
107
+ results = regex.exec(url);
108
+ if (!results) return null;
109
+ if (!results[2]) return '';
110
+ return decodeURIComponent(results[2].replace(/\+/g, " "));
111
+ }
112
+
113
  $('#cptui_choose_icon').on('click',function(e){
114
  e.preventDefault();
115
 
121
  $("#" + id).val(attachment.url);
122
  } else {
123
  return _orig_send_attachment.apply(this, [props, attachment]);
124
+ }
125
+ };
126
 
127
  wp.media.editor.open(button);
128
  return false;
147
  $('.cptui-help').on('click',function(e){
148
  e.preventDefault();
149
  });
150
+
151
+ $('.cptui-taxonomy-submit').on('click',function(e){
152
+ if ( $('.cptui-table :checkbox:checked').length == 0 ) {
153
+ e.preventDefault();
154
+ alert( cptui_tax_data.no_associated_type );
155
+ }
156
+ });
157
  })(jQuery);
js/cptui.min.js CHANGED
@@ -1 +1 @@
1
- !function($){function replaceDiacritics(s){for(var diacritics=[/[\300-\306]/g,/[\340-\346]/g,/[\310-\313]/g,/[\350-\353]/g,/[\314-\317]/g,/[\354-\357]/g,/[\322-\330]/g,/[\362-\370]/g,/[\331-\334]/g,/[\371-\374]/g,/[\321]/g,/[\361]/g,/[\307]/g,/[\347]/g],chars=["A","a","E","e","I","i","O","o","U","u","N","n","C","c"],i=0;i<diacritics.length;i++)s=s.replace(diacritics[i],chars[i]);return s}if($("#post_type").on("change",function(){$("#cptui_select_post_type").submit()}),$("#taxonomy").on("change",function(){$("#cptui_select_taxonomy").submit()}),$("#cpt_submit_delete").on("click",function(){return!!confirm(cptui_type_data.confirm)}),$("#support .question").each(function(){var tis=$(this),state=!1,answer=tis.next("div").slideUp();tis.on("click keydown",function(e){"keydown"===e.type&&32!==e.keyCode&&13!==e.keyCode||(e.preventDefault(),state=!state,answer.slideToggle(state),tis.toggleClass("active",state),tis.attr("aria-expanded",state.toString()),tis.focus())})}),$("#name").on("keyup",function(e){var value=$(this).val();value=value.replace(/ /g,"_"),value=value.toLowerCase(),value=replaceDiacritics(value),$(this).attr("value",value)}),void 0!=wp.media)var _custom_media=!0,_orig_send_attachment=wp.media.editor.send.attachment;$("#cptui_choose_icon").on("click",function(e){e.preventDefault();var button=$(this),id=jQuery("#menu_icon").attr("id");return _custom_media=!0,wp.media.editor.send.attachment=function(props,attachment){return _custom_media?void $("#"+id).val(attachment.url):_orig_send_attachment.apply(this,[props,attachment])},wp.media.editor.open(button),!1}),$("#togglelabels").on("click",function(e){e.preventDefault(),$("#labels_expand").toggleClass("toggledclosed")}),$("#togglesettings").on("click",function(e){e.preventDefault(),$("#settings_expand").toggleClass("toggledclosed")}),$("#labels_expand,#settings_expand").on("focus",function(e){$(this).hasClass("toggledclosed")&&$(this).toggleClass("toggledclosed")}),$("#labels_expand legend,#settings_expand legend").on("click",function(e){$(this).parent().toggleClass("toggledclosed")}),$(".cptui-help").on("click",function(e){e.preventDefault()})}(jQuery);
1
+ postboxes.add_postbox_toggles(pagenow),function($){function replaceDiacritics(s){for(var diacritics=[/[\300-\306]/g,/[\340-\346]/g,/[\310-\313]/g,/[\350-\353]/g,/[\314-\317]/g,/[\354-\357]/g,/[\322-\330]/g,/[\362-\370]/g,/[\331-\334]/g,/[\371-\374]/g,/[\321]/g,/[\361]/g,/[\307]/g,/[\347]/g],chars=["A","a","E","e","I","i","O","o","U","u","N","n","C","c"],i=0;i<diacritics.length;i++)s=s.replace(diacritics[i],chars[i]);return s}function replaceSpecialCharacters(s){return s=s.replace(/[^a-z0-9\s]/gi,"_")}function getParameterByName(name,url){url||(url=window.location.href),name=name.replace(/[\[\]]/g,"\\$&");var regex=new RegExp("[?&]"+name+"(=([^&#]*)|&|#|$)"),results=regex.exec(url);return results?results[2]?decodeURIComponent(results[2].replace(/\+/g," ")):"":null}if("edit"===getParameterByName("action"))var original_slug=$("#name").val();if($("#post_type").on("change",function(){$("#cptui_select_post_type").submit()}),$("#taxonomy").on("change",function(){$("#cptui_select_taxonomy").submit()}),$("#cpt_submit_delete").on("click",function(){return!!confirm(cptui_type_data.confirm)}),$("#support .question").each(function(){var tis=$(this),state=!1,answer=tis.next("div").slideUp();tis.on("click keydown",function(e){"keydown"===e.type&&32!==e.keyCode&&13!==e.keyCode||(e.preventDefault(),state=!state,answer.slideToggle(state),tis.toggleClass("active",state),tis.attr("aria-expanded",state.toString()),tis.focus())})}),$("#name").on("keyup",function(e){var value=$(this).val();if(value=value.replace(/ /g,"_"),value=value.toLowerCase(),value=replaceDiacritics(value),value=replaceSpecialCharacters(value),$(this).attr("value",value),void 0!=original_slug){var $slugchanged=$("#slugchanged");value!=original_slug?$slugchanged.removeClass("hidemessage"):$slugchanged.addClass("hidemessage")}}),void 0!=wp.media)var _custom_media=!0,_orig_send_attachment=wp.media.editor.send.attachment;$("#cptui_choose_icon").on("click",function(e){e.preventDefault();var button=$(this),id=jQuery("#menu_icon").attr("id");return _custom_media=!0,wp.media.editor.send.attachment=function(props,attachment){return _custom_media?void $("#"+id).val(attachment.url):_orig_send_attachment.apply(this,[props,attachment])},wp.media.editor.open(button),!1}),$("#togglelabels").on("click",function(e){e.preventDefault(),$("#labels_expand").toggleClass("toggledclosed")}),$("#togglesettings").on("click",function(e){e.preventDefault(),$("#settings_expand").toggleClass("toggledclosed")}),$("#labels_expand,#settings_expand").on("focus",function(e){$(this).hasClass("toggledclosed")&&$(this).toggleClass("toggledclosed")}),$("#labels_expand legend,#settings_expand legend").on("click",function(e){$(this).parent().toggleClass("toggledclosed")}),$(".cptui-help").on("click",function(e){e.preventDefault()}),$(".cptui-taxonomy-submit").on("click",function(e){0==$(".cptui-table :checkbox:checked").length&&(e.preventDefault(),alert(cptui_tax_data.no_associated_type))})}(jQuery);
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Custom Post Type UI ===
2
  Contributors: webdevstudios, tw2113, vegasgeek, modemlooper, williamsba1
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3084056
4
- Tags: custom post types, CPT, CMS, post, types, post type, cck, taxonomy, tax, custom
5
  Requires at least: 4.2
6
- Tested up to: 4.5
7
- Stable tag: 1.3.5
8
  License: GPLv2
9
 
10
  Admin UI for creating custom post types and custom taxonomies in WordPress
@@ -22,19 +22,35 @@ All official development on this plugin is on GitHub. New releases are still pub
22
  == Screenshots ==
23
 
24
  1. Add new post type screen and tab.
25
- 2. Edit post type screen and tab.
26
- 3. Add new taxonomy screen and tab.
27
- 4. Edit taxonomy screen and tab.
28
- 5. Registered post types and taxonomies from CPTUI
29
- 6. Import/Export Post Types screen.
30
- 7. Import/Export Taxonomies screen.
31
- 8. Get Code screen.
32
- 9. Debug Info screen.
33
- 10. Help/support screen.
34
- 11. About/Update Information/Donate screen.
35
 
36
  == Changelog ==
37
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  = 1.3.5 - 2016-6-3 =
39
  * Removed undefined index error for publicly_queryable in "Get Code" area. That parameter is targeted for 1.4.0 release.
40
 
@@ -125,6 +141,27 @@ All official development on this plugin is on GitHub. New releases are still pub
125
 
126
  == Upgrade Notice ==
127
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
128
  = 1.3.5 - 2016-6-3 =
129
  * Removed undefined index error for publicly_queryable in "Get Code" area. That parameter is targeted for 1.4.0 release.
130
 
@@ -176,43 +213,6 @@ All official development on this plugin is on GitHub. New releases are still pub
176
  * Updated: Cleaned up admin footer area for social links.
177
  * Updated: Moved all localization work to WordPress.org Translation packs
178
 
179
- = 1.2.4 =
180
- * Added: new CPTUI_VERSION constant to match naming of other current constants.
181
- * Added: CPTUI_VERSION constant to cptui.css string for cache busting.
182
-
183
- = 1.2.3 =
184
- * Fixed: copy/paste error with admin css. Props hinaloe.
185
-
186
- = 1.2.2 =
187
- * Fixed: Missing admin menu icon for some browsers.
188
- * Fixed: Undefined index notices for post type screen.
189
-
190
- = 1.2.1 =
191
- * Fixed: Undefined index notices for custom taxonomies and new fields from 1.2.0
192
-
193
- = 1.2.0 =
194
- * Added: Support for show_in_nav_menus parameter for post types.
195
- * Added: Support for taxonomy descriptions.
196
- * Added: Message on listings page if no post types or taxonomies are available.
197
- * Added: Note regarding 'public' parameter not being true by default for WordPress but is for CPTUI.
198
- * Added: Individual post type and taxonomy output for "Get Code" area.
199
- * Added: Fallback values for post type/taxonomy select input and get code area if no plural label provided.
200
- * Added: Support for custom query_var strings for post types.
201
- * Added: Support for show_in_rest and rest_base for post types and taxonomies for the upcoming WordPress REST API.
202
- * Added: Template hierarchy files to listings tables for user reference.
203
- * Added: Form labels in more areas to help with accessibility and usability.
204
- * Added: Fieldset method to Admin UI class for easily adding fieldset output.
205
- * Added: Debugging tab for use with CPTUI support.
206
- * Updated: Minimum version required. Now WordPress 4.2.
207
- * Updated: Heading tags match accessibility changes in WordPress 4.3.
208
- * Updated: Moved page title for some pages above tabs.
209
- * Updated: Textdomain now matches WordPress.org repo slug.
210
- * Updated: Added Visual Composer questions/answers to support section.
211
- * Updated: Added question/answer regarding spaces in post type slugs
212
- * Updated: Changed help icons to a Dashicon help icon.
213
- * Fixed: Support for YARPP plugin.
214
- * Fixed: Prevent potential issues with AJAX requests and our scripts/styles
215
-
216
  == Installation ==
217
 
218
  = Manual =
1
  === Custom Post Type UI ===
2
  Contributors: webdevstudios, tw2113, vegasgeek, modemlooper, williamsba1
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3084056
4
+ Tags: custom post types, CPT, CMS, post, types, post type, cck, taxonomy, tax, custom, content types, post types
5
  Requires at least: 4.2
6
+ Tested up to: 4.6
7
+ Stable tag: 1.4.0
8
  License: GPLv2
9
 
10
  Admin UI for creating custom post types and custom taxonomies in WordPress
22
  == Screenshots ==
23
 
24
  1. Add new post type screen and tab.
25
+ 2. Add new taxonomy screen and tab.
26
+ 3. Registered post types and taxonomies from CPTUI
27
+ 4. Import/Export Post Types screen.
28
+ 5. Get Code screen.
29
+ 6. Help/support screen.
 
 
 
 
 
30
 
31
  == Changelog ==
32
 
33
+ = 1.4.0 - 2016-8-22 =
34
+ * Added: "Export" tab on editor screens for quick access to post type or taxonomy export pages.
35
+ * Added: CPTUI notices are now dismissable via a button on the right side.
36
+ * Added: "Get code" link to registered post types and registered taxonomies listings.
37
+ * Added: More amending of incorrect characters in post type and taxonomy slugs. Latin standard alphabet only. Sorry.
38
+ * Added: New post type template stack reference from recent WordPress versions.
39
+ * Added: Side warning notification if post type or taxonomy slug has been edited.
40
+ * Added: Display About page upon activation of plugin.
41
+ * Added: Link below ads regarding getting them removed via purchase of CPTUI Extended.
42
+ * Added: No need to refresh page after initial save to see post types and taxonomies in menu.
43
+ * Added: Taxonomy support for show_in_menu and show_in_nav_menus.
44
+ * Fixed: Further improved labels for information text on inputs.
45
+ * Fixed: Hide "choose icon" button for non-js users.
46
+ * Fixed: Issue with misused "parent" label key that should be parent_item_colon.
47
+ * Fixed: Missed show_in_menu_string parameter for "get code" area.
48
+ * Fixed: Make sure taxonomies have required post type associated.
49
+ * Fixed: "Edit" links in listings area now account for network-admin when needed, with CPTUI Extended.
50
+ * Updated: Switch to dedicated dashicon for color consistency between applied admin color schemes.
51
+ * Updated: Updated about page.
52
+ * Updated: Further UI refinements to better match WordPress admin. Adapted styles found from metaboxes, including collapse/expand toggles.
53
+
54
  = 1.3.5 - 2016-6-3 =
55
  * Removed undefined index error for publicly_queryable in "Get Code" area. That parameter is targeted for 1.4.0 release.
56
 
141
 
142
  == Upgrade Notice ==
143
 
144
+ = 1.4.0 - 2016-8-22 =
145
+ * Added: "Export" tab on editor screens for quick access to post type or taxonomy export pages.
146
+ * Added: CPTUI notices are now dismissable via a button on the right side.
147
+ * Added: "Get code" link to registered post types and registered taxonomies listings.
148
+ * Added: More amending of incorrect characters in post type and taxonomy slugs. Latin standard alphabet only. Sorry.
149
+ * Added: New post type template stack reference from recent WordPress versions.
150
+ * Added: Side warning notification if post type or taxonomy slug has been edited.
151
+ * Added: Display About page upon activation of plugin.
152
+ * Added: Link below ads regarding getting them removed via purchase of CPTUI Extended.
153
+ * Added: No need to refresh page after initial save to see post types and taxonomies in menu.
154
+ * Added: Taxonomy support for show_in_menu and show_in_nav_menus.
155
+ * Fixed: Further improved labels for information text on inputs.
156
+ * Fixed: Hide "choose icon" button for non-js users.
157
+ * Fixed: Issue with misused "parent" label key that should be parent_item_colon.
158
+ * Fixed: Missed show_in_menu_string parameter for "get code" area.
159
+ * Fixed: Make sure taxonomies have required post type associated.
160
+ * Fixed: "Edit" links in listings area now account for network-admin when needed, with CPTUI Extended.
161
+ * Updated: Switch to dedicated dashicon for color consistency between applied admin color schemes.
162
+ * Updated: Updated about page.
163
+ * Updated: Further UI refinements to better match WordPress admin. Adapted styles found from metaboxes, including collapse/expand toggles.
164
+
165
  = 1.3.5 - 2016-6-3 =
166
  * Removed undefined index error for publicly_queryable in "Get Code" area. That parameter is targeted for 1.4.0 release.
167
 
213
  * Updated: Cleaned up admin footer area for social links.
214
  * Updated: Moved all localization work to WordPress.org Translation packs
215
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
216
  == Installation ==
217
 
218
  = Manual =