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