Custom Post Type UI - Version 1.5.0

Version Description

  • 2017-1-10 =
  • Added: Helper functions to grab individual post types or taxonomies from CPTUI options, function to check for support for custom saved values.
  • Added: Helper functions to mark and check if a new CPTUI install.
  • Added: FAQ clarifying why post type/taxonomy slugs are forced to underscores. We mean well, I assure you.
  • Added: Conversion from Cyrillic characters to latin equivalents.
  • Fixed: Parameter handling for get_terms() to match WordPress 4.5.
  • Fixed: Added "action" as a reserved taxonomy name.
  • Fixed: PHP Notices for rewrite array index, present since version 1.0.6
  • Fixed: Prevent triggering post type/taxonomy slug convert when navigating screen via tab key.
  • Fixed: Provide empty quote indicator in Registered Post Types and Taxonomies screen for empty values.
  • Fixed: Post types and taxonomies no longer need extra page refresh to be registered after an import.
  • Updated: Further evolved Registered Post Types and Taxonomies screen to better match list table styles.
  • Updated: Bumped minimum required WordPress version to 4.6.
  • Updated: Clarified what checking a checkbox does in regards to "Supports" area of post type settings.
  • Updated: Changed appropriate help/support links to docs.pluginize.com.
  • Updated: Added filter to tab collection for the tools section. You can now add your own tabs.
Download this release

Release Info

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

Code changes from version 1.4.3 to 1.5.0

changelog.txt CHANGED
@@ -1,3 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  = 1.1.3 - 2015-12-23 =
2
  * Bumping WordPress compatibility version only. No other changes involved.
3
 
1
+ = 1.3.5 - 2016-6-3 =
2
+ * Removed undefined index error for publicly_queryable in "Get Code" area. That parameter is targeted for 1.4.0 release.
3
+
4
+ = 1.3.4 - 2016-5-4 =
5
+ * Fixed: moved WDS-based services "ads" to within the plugin itself. Will not request remote resources.
6
+ * Fixed: Better output formatting if WDS/Pluginize "ads" failed to load images.
7
+ * Fixed: undefined variable error in cptui.js
8
+ * Added: Newsletter subscription form to stay uptodate with Custom Post Type UI & Custom Post Type UI Extended news.
9
+ * Added: Support page/FAQ info regarding Pluginize and recent sidebar developments.
10
+
11
+ = 1.3.3 - 2016-4-5 =
12
+ * Revert Changes for ajax/heartbeat API requests before post type registration. 3rd party or other plugins were breaking because post types were not registered.
13
+
14
+ = 1.3.2 - 2016-4-5 =
15
+ * Fixed: Logic issue with cptui js files loading where they weren't meant to.
16
+ * Fixed: Required markers missing on required post type fields.
17
+ * Fixed: Removed excess labels that are not used by WordPress core.
18
+ * Added: New contributors to readme file. Welcome John and Ryan.
19
+ * Updated: New screenshot from 1.3.0 release. Moved to assets folder so users will no longer download as part of CPTUI.
20
+ * Updated: Better prevention of running our code during ajax/heartbeat api requests.
21
+
22
+ = 1.3.1 - 2016-3-25 =
23
+ * Fixed: Logic issue for default values of `public` parameter for taxonomies added in 1.3.0.
24
+
25
+ = 1.3.0 =
26
+ * Added: "CPTUI_VERSION" constant and deprecated "CPT_VERSION".
27
+ * Added: "Public" parameter for taxonomies
28
+ * Added: "View Post Types" and "View Taxonomies" tabs at top of add/edit screens.
29
+ * Added: Better prevention of potential duplicate slugs in new post types and taxonomies.
30
+ * Added: Current theme's textdomain as output in get code textareas.
31
+ * Added: Fill in singular and plural label fields if none provided. WordPress does not auto-fill these.
32
+ * Added: For developers: plenty of extra hooks all over for customization needs.
33
+ * Added: Javascript-based prevention of spaces and special characters for post type and taxonomy slugs.
34
+ * Added: Legend tag support to admin UI class.
35
+ * Added: Minified copies of our JavaScript and CSS. Define SCRIPT_DEBUG to true to use non-minified versions.
36
+ * Added: New post type and taxonomy labels provided by WordPress 4.3 and 4.4 releases.
37
+ * See: https://make.wordpress.org/core/2015/12/11/additional-labels-for-custom-post-types-and-custom-taxonomies/
38
+ * Added: Notes to post type and taxonomy edit screens about WordPress core's post types and taxonomies.
39
+ * Added: Taxonomy slug update ability with preserved term association.
40
+ * Added: Title, Editor, and Featured Image now checked by default for new post types.
41
+ * Added: "Show in Quick Edit" taxonomy parameter available in WP 4.2
42
+ * Added: Promo spots on add/edit screens for other products from WebDevStudios.
43
+ * Fixed: Need to visit permalinks page to flush rewrite rules after creating new post type or taxonomy.
44
+ * Fixed: Missing REST API based parameters in "Get Code" output.
45
+ * Updated: Increased accessibility coverage.
46
+ * Updated: Revised how tabs are added to pages so 3rd party developers can add their own tabs.
47
+ * Updated: Improved string consistency in our UI helper notes. Props @GaryJ
48
+ * Updated: Tested on WordPress 4.5
49
+ * Updated: Cleaned up admin footer area for social links.
50
+ * Updated: Moved all localization work to WordPress.org Translation packs
51
+
52
+ = 1.2.4 =
53
+ * Added: new CPTUI_VERSION constant to match naming of other current constants.
54
+ * Added: CPTUI_VERSION constant to cptui.css string for cache busting.
55
+
56
+ = 1.2.3 - 2016-01-31 =
57
+ * Fixed: copy/paste error with admin css. Props hinaloe.
58
+
59
+ = 1.2.2 - 2016-01-30 =
60
+ * Fixed: Missing admin menu icon for some browsers.
61
+ * Fixed: Undefined index notices for post type screen.
62
+
63
+ = 1.2.1 - 2016-01-17 =
64
+ * Fixed: Undefined index notices for custom taxonomies and new fields from 1.2.0
65
+
66
+ = 1.2.0 - 2016-01-15 =
67
+ * Added: Support for show_in_nav_menus parameter for post types.
68
+ * Added: Support for taxonomy descriptions.
69
+ * Added: Message on listings page if no post types or taxonomies are available.
70
+ * Added: Note regarding 'public' parameter not being true by default for WordPress but is for CPTUI.
71
+ * Added: Individual post type and taxonomy output for "Get Code" area.
72
+ * Added: Fallback values for post type/taxonomy select input and get code area if no plural label provided.
73
+ * Added: Support for custom query_var strings for post types.
74
+ * Added: Support for show_in_rest and rest_base for post types and taxonomies for the upcoming WordPress REST API.
75
+ * Added: Template hierarchy files to listings tables for user reference.
76
+ * Added: Form labels in more areas to help with accessibility and usability.
77
+ * Added: Fieldset method to Admin UI class for easily adding fieldset output.
78
+ * Added: Debugging tab for use with CPTUI support.
79
+ * Updated: Minimum version required. Now WordPress 4.2.
80
+ * Updated: Heading tags match accessibility changes in WordPress 4.3.
81
+ * Updated: Moved page title for some pages above tabs.
82
+ * Updated: Textdomain now matches WordPress.org repo slug.
83
+ * Updated: Added Visual Composer questions/answers to support section.
84
+ * Updated: Added question/answer regarding spaces in post type slugs
85
+ * Updated: Changed help icons to a Dashicon help icon.
86
+ * Fixed: Support for YARPP plugin.
87
+ * Fixed: Prevent potential issues with AJAX requests and our scripts/styles
88
+
89
  = 1.1.3 - 2015-12-23 =
90
  * Bumping WordPress compatibility version only. No other changes involved.
91
 
classes/class.cptui_debug_info.php CHANGED
@@ -206,7 +206,7 @@ class CPTUI_Debug_Info {
206
  *
207
  * @since 1.2.0
208
  *
209
- * @param array $args Array of arguments for the method.
210
  * @return bool
211
  */
212
  public function send_email( $args = array() ) {
206
  *
207
  * @since 1.2.0
208
  *
209
+ * @param array $args Array of arguments for the method. Optional.
210
  * @return bool
211
  */
212
  public function send_email( $args = array() ) {
css/cptui.css CHANGED
@@ -144,6 +144,10 @@
144
  margin-top: 0;
145
  }
146
 
 
 
 
 
147
  .about-wrap .feature-rest div {
148
  width: 50% !important;
149
  padding-right: 100px;
@@ -205,6 +209,12 @@
205
  margin-bottom: 1em !important;
206
  }
207
 
 
 
 
 
 
 
208
  .js #cptui_select_post_type input[type='submit'],
209
  .js #cptui_select_taxonomy input[type='submit'] {
210
  display: none;
@@ -359,3 +369,17 @@ fieldset .cptui-help {
359
  #poststuff {
360
  min-width: 463px;
361
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
144
  margin-top: 0;
145
  }
146
 
147
+ .about-wrap .changelog h2 {
148
+ text-align: center;
149
+ }
150
+
151
  .about-wrap .feature-rest div {
152
  width: 50% !important;
153
  padding-right: 100px;
209
  margin-bottom: 1em !important;
210
  }
211
 
212
+ .about-wrap .cptui-badge {
213
+ position: absolute;
214
+ top: 0;
215
+ right: 0;
216
+ }
217
+
218
  .js #cptui_select_post_type input[type='submit'],
219
  .js #cptui_select_taxonomy input[type='submit'] {
220
  display: none;
369
  #poststuff {
370
  min-width: 463px;
371
  }
372
+
373
+ @media screen and (min-width: 768px) {
374
+ .cptui-badge {
375
+ padding-top: 142px;
376
+ height: 50px;
377
+ width: 173px;
378
+ color: #fafafa;
379
+ font-weight: bold;
380
+ font-size: 14px;
381
+ text-align: center;
382
+ margin: 0 -5px;
383
+ background: url(../images/cptui-icon-173x173.png) no-repeat;
384
+ }
385
+ }
css/cptui.min.css CHANGED
@@ -1 +1 @@
1
- .posttypesui,.taxonomiesui{width:calc(100% - 300px)}.posttypesui .cptui-section:first-child,.taxonomiesui .cptui-section:first-child{margin-top:30px}.posttypesui .postbox-container,.taxonomiesui .postbox-container{width:100%}.posttypesui .postbox .toggle-indicator:before,.taxonomiesui .postbox .toggle-indicator:before{content:"\f142";display:inline-block;font:normal 20px/1 dashicons;speak:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-decoration:none!important}.posttypesui .postbox.closed .handlediv .toggle-indicator:before,.taxonomiesui .postbox.closed .handlediv .toggle-indicator:before{content:"\f140"}.posttypesui .postbox .hndle,.taxonomiesui .postbox .hndle{cursor:pointer}.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;-ms-grid-row-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%}#poststuff{min-width:463px}
1
+ .posttypesui,.taxonomiesui{width:calc(100% - 300px)}.posttypesui .cptui-section:first-child,.taxonomiesui .cptui-section:first-child{margin-top:30px}.posttypesui .postbox-container,.taxonomiesui .postbox-container{width:100%}.posttypesui .postbox .toggle-indicator:before,.taxonomiesui .postbox .toggle-indicator:before{content:"\f142";display:inline-block;font:normal 20px/1 dashicons;speak:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-decoration:none!important}.posttypesui .postbox.closed .handlediv .toggle-indicator:before,.taxonomiesui .postbox.closed .handlediv .toggle-indicator:before{content:"\f140"}.posttypesui .postbox .hndle,.taxonomiesui .postbox .hndle{cursor:pointer}.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 .changelog h2{text-align:center}.about-wrap .feature-rest div{width:50%!important;padding-right:100px;box-sizing:border-box;margin:0!important}.about-wrap .feature-rest div.last-feature{padding-left:100px;padding-right:0}.about-wrap .feature-rest div.icon{width:0!important;padding:0;margin:0}.about-wrap .feature-rest div.icon:before{font-weight:400;width:100%;font-size:170px;line-height:125px;color:#9c5d90;display:inline-block;position:relative;text-align:center;speak:none;margin:0 0 0 -100px;content:"\e01d";-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.rtl .about-wrap .feature-rest div{padding-left:100px}.rtl .about-wrap .feature-rest div.last-feature{padding-right:100px;padding-left:0}.rtl .about-wrap .feature-rest div.icon:before{margin:0 -100px 0 0}.about-wrap .about-integrations{background:#fff;margin:20px 0;padding:1px 20px 10px}.about-wrap .changelog h4{line-height:1.4}.about-wrap .cptui-about-text{margin-bottom:1em!important}.about-wrap .cptui-badge{position:absolute;top:0;right:0}#togglelabels,.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;-ms-grid-row-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%}#poststuff{min-width:463px}@media screen and (min-width:768px){.cptui-badge{padding-top:142px;height:50px;width:173px;color:#fafafa;font-weight:700;font-size:14px;text-align:center;margin:0 -5px;background:url(../images/cptui-icon-173x173.png) no-repeat}}
css/cptui.scss CHANGED
@@ -1,3 +1,5 @@
 
 
1
  .posttypesui, .taxonomiesui {
2
  .cptui-section:first-child {
3
  margin-top: 30px;
@@ -123,6 +125,11 @@
123
  h3 + .cptui-feature {
124
  margin-top: 0;
125
  }
 
 
 
 
 
126
  .feature-rest {
127
  div {
128
  width: 50% !important;
@@ -185,6 +192,11 @@
185
  .cptui-about-text {
186
  margin-bottom: 1em !important;
187
  }
 
 
 
 
 
188
  }
189
  .js {
190
  #cptui_select_post_type input[type='submit'],
@@ -347,3 +359,17 @@
347
  #poststuff {
348
  min-width: 463px;
349
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ $min-tablet: "screen and (min-width: 768px)";
2
+
3
  .posttypesui, .taxonomiesui {
4
  .cptui-section:first-child {
5
  margin-top: 30px;
125
  h3 + .cptui-feature {
126
  margin-top: 0;
127
  }
128
+ .changelog {
129
+ h2 {
130
+ text-align: center;
131
+ }
132
+ }
133
  .feature-rest {
134
  div {
135
  width: 50% !important;
192
  .cptui-about-text {
193
  margin-bottom: 1em !important;
194
  }
195
+ .cptui-badge {
196
+ position: absolute;
197
+ top: 0;
198
+ right: 0;
199
+ }
200
  }
201
  .js {
202
  #cptui_select_post_type input[type='submit'],
359
  #poststuff {
360
  min-width: 463px;
361
  }
362
+
363
+ @media #{$min-tablet} {
364
+ .cptui-badge {
365
+ padding-top: 142px;
366
+ height: 50px;
367
+ width: 173px;
368
+ color: #fafafa;
369
+ font-weight: bold;
370
+ font-size: 14px;
371
+ text-align: center;
372
+ margin: 0 -5px;
373
+ background: url(../images/cptui-icon-173x173.png) no-repeat;
374
+ }
375
+ }
custom-post-type-ui.php CHANGED
@@ -15,7 +15,7 @@ Plugin Name: Custom Post Type UI
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.3
19
  Author URI: https://webdevstudios.com/
20
  Text Domain: custom-post-type-ui
21
  Domain Path: /languages
@@ -27,8 +27,8 @@ if ( ! defined( 'ABSPATH' ) ) {
27
  exit;
28
  }
29
 
30
- define( 'CPT_VERSION', '1.4.3' ); // Left for legacy purposes.
31
- define( 'CPTUI_VERSION', '1.4.3' );
32
  define( 'CPTUI_WP_VERSION', get_bloginfo( 'version' ) );
33
 
34
  /**
@@ -78,12 +78,14 @@ function cptui_make_activation_redirect() {
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
  );
@@ -139,7 +141,7 @@ function cptui_plugin_menu() {
139
  add_submenu_page( $parent_slug, __( 'Add/Edit Post Types', 'custom-post-type-ui' ), __( 'Add/Edit Post Types', 'custom-post-type-ui' ), $capability, 'cptui_manage_post_types', 'cptui_manage_post_types' );
140
  add_submenu_page( $parent_slug, __( 'Add/Edit Taxonomies', 'custom-post-type-ui' ), __( 'Add/Edit Taxonomies', 'custom-post-type-ui' ), $capability, 'cptui_manage_taxonomies', 'cptui_manage_taxonomies' );
141
  add_submenu_page( $parent_slug, __( 'Registered Types and Taxes', 'custom-post-type-ui' ), __( 'Registered Types/Taxes', 'custom-post-type-ui' ), $capability, 'cptui_listings', 'cptui_listings' );
142
- add_submenu_page( $parent_slug, __( 'Import/Export', 'custom-post-type-ui' ), __( 'Import/Export', 'custom-post-type-ui' ), $capability, 'cptui_importexport', 'cptui_importexport' );
143
  add_submenu_page( $parent_slug, __( 'Help/Support', 'custom-post-type-ui' ), __( 'Help/Support', 'custom-post-type-ui' ), $capability, 'cptui_support', 'cptui_support' );
144
 
145
  /**
@@ -191,7 +193,7 @@ function cptui_create_submenus() {
191
  require_once( plugin_dir_path( __FILE__ ) . 'inc/post-types.php' );
192
  require_once( plugin_dir_path( __FILE__ ) . 'inc/taxonomies.php' );
193
  require_once( plugin_dir_path( __FILE__ ) . 'inc/listings.php' );
194
- require_once( plugin_dir_path( __FILE__ ) . 'inc/import_export.php' );
195
  require_once( plugin_dir_path( __FILE__ ) . 'inc/support.php' );
196
  }
197
  add_action( 'cptui_loaded', 'cptui_create_submenus' );
@@ -279,7 +281,7 @@ add_action( 'init', 'cptui_create_custom_post_types', 10 ); // Leave on standard
279
  *
280
  * @internal
281
  *
282
- * @param array $post_type Post type array to register.
283
  * @return null Result of register_post_type.
284
  */
285
  function cptui_register_single_post_type( $post_type = array() ) {
@@ -365,7 +367,11 @@ function cptui_register_single_post_type( $post_type = array() ) {
365
  // Core converts to an empty array anyway, so safe to leave this instead of passing in boolean true.
366
  $rewrite = array();
367
  $rewrite['slug'] = ( ! empty( $post_type['rewrite_slug'] ) ) ? $post_type['rewrite_slug'] : $post_type['name'];
368
- $rewrite['with_front'] = ( 'false' === disp_boolean( $post_type['rewrite_withfront'] ) ) ? false : true;
 
 
 
 
369
  }
370
 
371
  $menu_icon = ( ! empty( $post_type['menu_icon'] ) ) ? $post_type['menu_icon'] : null;
@@ -494,7 +500,7 @@ add_action( 'init', 'cptui_create_custom_taxonomies', 9 ); // Leave on standard
494
  *
495
  * @internal
496
  *
497
- * @param array $taxonomy Taxonomy array to register.
498
  * @return null Result of register_taxonomy.
499
  */
500
  function cptui_register_single_taxonomy( $taxonomy = array() ) {
@@ -523,8 +529,14 @@ function cptui_register_single_taxonomy( $taxonomy = array() ) {
523
  if ( false !== get_disp_boolean( $taxonomy['rewrite'] ) ) {
524
  $rewrite = array();
525
  $rewrite['slug'] = ( ! empty( $taxonomy['rewrite_slug'] ) ) ? $taxonomy['rewrite_slug'] : $taxonomy['name'];
526
- $rewrite['with_front'] = ( 'false' === disp_boolean( $taxonomy['rewrite_withfront'] ) ) ? false : true;
527
- $rewrite['hierarchical'] = ( 'true' === disp_boolean( $taxonomy['rewrite_hierarchical'] ) ) ? true : false;
 
 
 
 
 
 
528
  }
529
 
530
  if ( in_array( $taxonomy['query_var'], array( 'true', 'false', '0', '1' ) ) ) {
@@ -597,7 +609,7 @@ function cptui_register_single_taxonomy( $taxonomy = array() ) {
597
  *
598
  * @since 1.0.0
599
  *
600
- * @param string $page Whether it's the CPT or Taxonomy page.
601
  */
602
  function cptui_settings_tab_menu( $page = 'post_types' ) {
603
 
@@ -697,10 +709,10 @@ add_action( 'admin_init', 'cptui_convert_settings' );
697
  *
698
  * @since 1.0.0
699
  *
700
- * @param string $action The type of action that occurred.
701
- * @param string $object_type Whether it's from a post type or taxonomy.
702
- * @param bool $success Whether the action succeeded or not.
703
- * @param string $custom Custom message if necessary.
704
  * @return bool|string false on no message, else HTML div with our notice message.
705
  */
706
  function cptui_admin_notices( $action = '', $object_type = '', $success = true, $custom = '' ) {
@@ -769,7 +781,7 @@ function cptui_admin_notices( $action = '', $object_type = '', $success = true,
769
  *
770
  * @since 1.0.5
771
  *
772
- * @param string $type Type to return. Either 'post_types' or 'taxonomies'.
773
  * @return array Array of keys needing preservered for the requested type.
774
  */
775
  function cptui_get_preserved_keys( $type = '' ) {
@@ -808,10 +820,10 @@ function cptui_get_preserved_keys( $type = '' ) {
808
  *
809
  * @since 1.0.5
810
  *
811
- * @param string $type Type to return. Either 'post_types' or 'taxonomies'.
812
- * @param string $key Requested label key.
813
- * @param string $plural Plural verbiage for the requested label and type.
814
- * @param string $singular Singular verbiage for the requested label and type.
815
  * @return string Internationalized default label.
816
  */
817
  function cptui_get_preserved_label( $type = '', $key = '', $plural = '', $singular = '' ) {
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.5.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.5.0' ); // Left for legacy purposes.
31
+ define( 'CPTUI_VERSION', '1.5.0' );
32
  define( 'CPTUI_WP_VERSION', get_bloginfo( 'version' ) );
33
 
34
  /**
78
  return;
79
  }
80
 
81
+ if ( ! cptui_is_new_install() ) {
82
+ return;
83
+ }
84
 
85
  // Redirect to CPTUI about page.
86
  wp_safe_redirect(
87
  add_query_arg(
88
+ array( 'page' => 'cptui_main_menu' ),
89
  cptui_admin_url( 'admin.php?page=cptui_main_menu' )
90
  )
91
  );
141
  add_submenu_page( $parent_slug, __( 'Add/Edit Post Types', 'custom-post-type-ui' ), __( 'Add/Edit Post Types', 'custom-post-type-ui' ), $capability, 'cptui_manage_post_types', 'cptui_manage_post_types' );
142
  add_submenu_page( $parent_slug, __( 'Add/Edit Taxonomies', 'custom-post-type-ui' ), __( 'Add/Edit Taxonomies', 'custom-post-type-ui' ), $capability, 'cptui_manage_taxonomies', 'cptui_manage_taxonomies' );
143
  add_submenu_page( $parent_slug, __( 'Registered Types and Taxes', 'custom-post-type-ui' ), __( 'Registered Types/Taxes', 'custom-post-type-ui' ), $capability, 'cptui_listings', 'cptui_listings' );
144
+ add_submenu_page( $parent_slug, __( 'Custom Post Type UI Tools', 'custom-post-type-ui' ), __( 'Tools', 'custom-post-type-ui' ), $capability, 'cptui_tools', 'cptui_tools' );
145
  add_submenu_page( $parent_slug, __( 'Help/Support', 'custom-post-type-ui' ), __( 'Help/Support', 'custom-post-type-ui' ), $capability, 'cptui_support', 'cptui_support' );
146
 
147
  /**
193
  require_once( plugin_dir_path( __FILE__ ) . 'inc/post-types.php' );
194
  require_once( plugin_dir_path( __FILE__ ) . 'inc/taxonomies.php' );
195
  require_once( plugin_dir_path( __FILE__ ) . 'inc/listings.php' );
196
+ require_once( plugin_dir_path( __FILE__ ) . 'inc/tools.php' );
197
  require_once( plugin_dir_path( __FILE__ ) . 'inc/support.php' );
198
  }
199
  add_action( 'cptui_loaded', 'cptui_create_submenus' );
281
  *
282
  * @internal
283
  *
284
+ * @param array $post_type Post type array to register. Optional.
285
  * @return null Result of register_post_type.
286
  */
287
  function cptui_register_single_post_type( $post_type = array() ) {
367
  // Core converts to an empty array anyway, so safe to leave this instead of passing in boolean true.
368
  $rewrite = array();
369
  $rewrite['slug'] = ( ! empty( $post_type['rewrite_slug'] ) ) ? $post_type['rewrite_slug'] : $post_type['name'];
370
+
371
+ $rewrite['with_front'] = true; // Default value.
372
+ if ( isset( $post_type['rewrite_withfront'] ) ) {
373
+ $rewrite['with_front'] = ( 'false' === disp_boolean( $post_type['rewrite_withfront'] ) ) ? false : true;
374
+ }
375
  }
376
 
377
  $menu_icon = ( ! empty( $post_type['menu_icon'] ) ) ? $post_type['menu_icon'] : null;
500
  *
501
  * @internal
502
  *
503
+ * @param array $taxonomy Taxonomy array to register. Optional.
504
  * @return null Result of register_taxonomy.
505
  */
506
  function cptui_register_single_taxonomy( $taxonomy = array() ) {
529
  if ( false !== get_disp_boolean( $taxonomy['rewrite'] ) ) {
530
  $rewrite = array();
531
  $rewrite['slug'] = ( ! empty( $taxonomy['rewrite_slug'] ) ) ? $taxonomy['rewrite_slug'] : $taxonomy['name'];
532
+ $rewrite['with_front'] = true;
533
+ if ( isset( $taxonomy['rewrite_withfront'] ) ) {
534
+ $rewrite['with_front'] = ( 'false' === disp_boolean( $taxonomy['rewrite_withfront'] ) ) ? false : true;
535
+ }
536
+ $rewrite['hierarchical'] = false;
537
+ if ( isset( $taxonomy['rewrite_hierarchical'] ) ) {
538
+ $rewrite['hierarchical'] = ( 'true' === disp_boolean( $taxonomy['rewrite_hierarchical'] ) ) ? true : false;
539
+ }
540
  }
541
 
542
  if ( in_array( $taxonomy['query_var'], array( 'true', 'false', '0', '1' ) ) ) {
609
  *
610
  * @since 1.0.0
611
  *
612
+ * @param string $page Whether it's the CPT or Taxonomy page. Optional. Default "post_types".
613
  */
614
  function cptui_settings_tab_menu( $page = 'post_types' ) {
615
 
709
  *
710
  * @since 1.0.0
711
  *
712
+ * @param string $action The type of action that occurred. Optional. Default empty string.
713
+ * @param string $object_type Whether it's from a post type or taxonomy. Optional. Default empty string.
714
+ * @param bool $success Whether the action succeeded or not. Optional. Default true.
715
+ * @param string $custom Custom message if necessary. Optional. Default empty string.
716
  * @return bool|string false on no message, else HTML div with our notice message.
717
  */
718
  function cptui_admin_notices( $action = '', $object_type = '', $success = true, $custom = '' ) {
781
  *
782
  * @since 1.0.5
783
  *
784
+ * @param string $type Type to return. Either 'post_types' or 'taxonomies'. Optional. Default empty string.
785
  * @return array Array of keys needing preservered for the requested type.
786
  */
787
  function cptui_get_preserved_keys( $type = '' ) {
820
  *
821
  * @since 1.0.5
822
  *
823
+ * @param string $type Type to return. Either 'post_types' or 'taxonomies'. Optional. Default empty string.
824
+ * @param string $key Requested label key. Optional. Default empty string.
825
+ * @param string $plural Plural verbiage for the requested label and type. Optional. Default empty string.
826
+ * @param string $singular Singular verbiage for the requested label and type. Optional. Default empty string.
827
  * @return string Internationalized default label.
828
  */
829
  function cptui_get_preserved_label( $type = '', $key = '', $plural = '', $singular = '' ) {
images/cptui-icon-173x173.png ADDED
Binary file
images/cptui-icon-256x256.png ADDED
Binary file
inc/about.php CHANGED
@@ -46,6 +46,7 @@ function cptui_settings() {
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
  /**
@@ -55,29 +56,20 @@ function cptui_settings() {
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>
73
- </div>
74
- <div>
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>
@@ -133,10 +125,17 @@ add_action( 'cptui_main_page_extra_notes', 'cptui_pluginize_content', 9 );
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
 
@@ -185,3 +184,18 @@ function cptui_about_page_newsletter_form() {
185
  <!--End mc_embed_signup-->
186
  <?php
187
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ <div class="cptui-badge"></div>
50
 
51
  <?php
52
  /**
56
  */
57
  do_action( 'cptui_main_page_before_changelog' ); ?>
58
 
59
+ <h2><?php printf( esc_html__( "What's new in version %s", 'custom-post-type-ui' ), CPTUI_VERSION ); ?></h2>
60
  <div class="changelog about-integrations">
61
  <div class="cptui-feature feature-section col three-col">
62
  <div>
63
+ <h2><?php esc_html_e( 'Renamed the Import/Export menu.', 'custom-post-type-ui' ); ?></h2>
64
+ <p><?php esc_html_e( 'As Custom Post Type UI has evolved, we have found need to rename one of the menus. The Import/Export menu has now been renamed "Tools" to better reflect the utilities provided there.', 'custom-post-type-ui' ); ?></p>
65
  </div>
66
  <div>
67
+ <h2><?php esc_html_e( 'Eliminated page refresh need for importing.', 'custom-post-type-ui' ); ?></h2>
68
+ <p><?php esc_html_e( 'Previously we eliminated page refresh need while creating new post types and taxonomies. We noticed this did not apply when importing settings. With this latest release, we have amended the issue.', 'custom-post-type-ui' ); ?></p>
 
 
 
 
 
 
 
 
 
69
  </div>
70
  <div class="last-feature">
71
+ <h2><?php esc_html_e( 'Multiple issue fixes.', 'custom-post-type-ui' ); ?></h2>
72
+ <p><?php esc_html_e( 'We have fixed the following issues in this version. Added "action" as a reserved taxonomy name. Updated `get_terms()` handling for WordPress 4.5. Fixed PHP notices related to rewrite indexes, that were present since version 1.0.6. Prevented triggering a slug conversion when tabbing through the edit screen.', 'custom-post-type-ui' ) ?></p>
73
  </div>
74
  </div>
75
  </div>
125
  * @since 1.4.0
126
  */
127
  function cptui_about_page_newsletter() {
128
+
129
+ if ( cptui_is_new_install() ) {
130
+ return '';
131
+ }
132
+
133
  ?>
134
  <h3><?php esc_html_e( 'Stay informed', 'custom-post-type-ui' ); ?></h3>
135
  <?php
136
  cptui_about_page_newsletter_form();
137
+
138
+ return '';
139
  }
140
  add_action( 'cptui_main_page_before_changelog', 'cptui_about_page_newsletter' );
141
 
184
  <!--End mc_embed_signup-->
185
  <?php
186
  }
187
+
188
+ /**
189
+ * Marks site as not new at the end of the about/main page.
190
+ *
191
+ * Can't be done on activation or else cptui_is_new_install() will immediately start
192
+ * returning false. So we'll do it at the end of the redirected landing page.
193
+ *
194
+ * @since 1.5.0
195
+ */
196
+ function cptui_mark_not_new() {
197
+ if ( cptui_is_new_install() ) {
198
+ cptui_set_not_new_install();
199
+ }
200
+ }
201
+ add_action( 'cptui_main_page_extra_notes', 'cptui_mark_not_new', 999 );
inc/listings.php CHANGED
@@ -59,12 +59,15 @@ function cptui_listings() {
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 ) {
65
  echo '<th>' . esc_html( $head ) . '</th>';
66
  } ?>
67
  </tr>
 
 
68
  <?php
69
  $counter = 1;
70
  foreach ( $post_types as $post_type => $post_type_settings ) {
@@ -106,13 +109,14 @@ function cptui_listings() {
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
 
@@ -128,7 +132,7 @@ function cptui_listings() {
128
  if ( in_array( $value, array( '1', '0' ) ) ) {
129
  echo esc_html( disp_boolean( $value ) );
130
  } else {
131
- echo esc_html( $value );
132
  }
133
  echo '<br/>';
134
  } ?>
@@ -141,9 +145,17 @@ function cptui_listings() {
141
  </td>
142
  <td>
143
  <?php
144
- foreach ( $taxonomies['taxonomies'] as $taxonomy ) {
145
- echo esc_html( $taxonomy ) . '<br/>';
146
- } ?>
 
 
 
 
 
 
 
 
147
  </td>
148
  <td>
149
  <?php
@@ -160,7 +172,10 @@ function cptui_listings() {
160
  );
161
  }
162
  } else {
163
- esc_html_e( 'No custom labels to display', 'custom-post-type-ui' );
 
 
 
164
  }
165
  ?>
166
  </td>
@@ -196,12 +211,15 @@ function cptui_listings() {
196
  $counter++;
197
  }
198
  ?>
 
 
199
  <tr>
200
  <?php
201
  foreach ( $post_type_table_heads as $head ) {
202
  echo '<th>' . esc_html( $head ) . '</th>';
203
  } ?>
204
  </tr>
 
205
  </table>
206
  <?php
207
  /**
@@ -244,12 +262,15 @@ function cptui_listings() {
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 ) {
250
  echo '<th>' . esc_html( $head ) . '</th>';
251
  } ?>
252
  </tr>
 
 
253
  <?php
254
  $counter = 1;
255
  foreach ( $taxonomies as $taxonomy => $taxonomy_settings ) {
@@ -284,13 +305,14 @@ function cptui_listings() {
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>
@@ -301,7 +323,7 @@ function cptui_listings() {
301
  if ( in_array( $value, array( '1', '0' ) ) ) {
302
  echo esc_html( disp_boolean( $value ) );
303
  } else {
304
- echo esc_html( $value );
305
  }
306
  echo '<br/>';
307
  } ?>
@@ -326,12 +348,15 @@ function cptui_listings() {
326
  );
327
  }
328
  } else {
329
- esc_html_e( 'No custom labels to display', 'custom-post-type-ui' );
 
 
 
330
  }
331
  ?>
332
  </td>
333
  <td>
334
- <p><strong><?php esc_html_e( 'Archives', 'custom-post-type-ui' ); ?></strong><br />
335
  taxonomy-<?php echo esc_html( $taxonomy ); ?>-term_slug.php *<br />
336
  taxonomy-<?php echo esc_html( $taxonomy ); ?>.php<br />
337
  taxonomy.php<br />
@@ -354,12 +379,15 @@ function cptui_listings() {
354
  $counter++;
355
  }
356
  ?>
 
 
357
  <tr>
358
  <?php
359
  foreach ( $taxonomy_table_heads as $head ) {
360
  echo '<th>' . esc_html( $head ) . '</th>';
361
  } ?>
362
  </tr>
 
363
  </table>
364
  <?php
365
  /**
59
  do_action( 'cptui_before_post_type_listing' );
60
  ?>
61
  <table class="wp-list-table widefat post-type-listing">
62
+ <thead>
63
  <tr>
64
  <?php
65
  foreach ( $post_type_table_heads as $head ) {
66
  echo '<th>' . esc_html( $head ) . '</th>';
67
  } ?>
68
  </tr>
69
+ </thead>
70
+ <tbody>
71
  <?php
72
  $counter = 1;
73
  foreach ( $post_types as $post_type => $post_type_settings ) {
109
  <td>
110
  <?php
111
  printf(
112
+ '<a href="%s">%s</a><br/>
113
+ <a href="%s">%s</a><br/>',
114
  esc_attr( $post_type_link_url ),
115
  sprintf(
116
  esc_html__( 'Edit %s', 'custom-post-type-ui' ),
117
  esc_html( $post_type )
118
  ),
119
+ esc_attr( admin_url( 'admin.php?page=cptui_tools&action=get_code#' . $post_type ) ),
120
  esc_html__( 'Get code', 'custom-post-type-ui' )
121
  );
122
 
132
  if ( in_array( $value, array( '1', '0' ) ) ) {
133
  echo esc_html( disp_boolean( $value ) );
134
  } else {
135
+ echo ( ! empty( $value ) ) ? esc_html( $value ) : '""';
136
  }
137
  echo '<br/>';
138
  } ?>
145
  </td>
146
  <td>
147
  <?php
148
+ if ( ! empty( $taxonomies['taxonomies'] ) ) {
149
+ foreach ( $taxonomies['taxonomies'] as $taxonomy ) {
150
+ echo esc_html( $taxonomy ) . '<br/>';
151
+ }
152
+ } else {
153
+ printf(
154
+ '<span aria-hidden="true">—</span><span class="screen-reader-text">%s</span>',
155
+ esc_html__( 'No associated taxonomies', 'custom-post-type-ui' )
156
+ );
157
+ }
158
+ ?>
159
  </td>
160
  <td>
161
  <?php
172
  );
173
  }
174
  } else {
175
+ printf(
176
+ '<span aria-hidden="true">—</span><span class="screen-reader-text">%s</span>',
177
+ esc_html__( 'No custom labels to display', 'custom-post-type-ui' )
178
+ );
179
  }
180
  ?>
181
  </td>
211
  $counter++;
212
  }
213
  ?>
214
+ </tbody>
215
+ <tfoot>
216
  <tr>
217
  <?php
218
  foreach ( $post_type_table_heads as $head ) {
219
  echo '<th>' . esc_html( $head ) . '</th>';
220
  } ?>
221
  </tr>
222
+ </tfoot>
223
  </table>
224
  <?php
225
  /**
262
  do_action( 'cptui_before_taxonomy_listing' );
263
  ?>
264
  <table class="wp-list-table widefat taxonomy-listing">
265
+ <thead>
266
  <tr>
267
  <?php
268
  foreach ( $taxonomy_table_heads as $head ) {
269
  echo '<th>' . esc_html( $head ) . '</th>';
270
  } ?>
271
  </tr>
272
+ </thead>
273
+ <tbody>
274
  <?php
275
  $counter = 1;
276
  foreach ( $taxonomies as $taxonomy => $taxonomy_settings ) {
305
  $taxonomy_link_url = ( is_network_admin() ) ? network_admin_url( $edit_path ) : admin_url( $edit_path ); ?>
306
  <td>
307
  <?php printf(
308
+ '<a href="%s">%s</a><br/>
309
+ <a href="%s">%s</a>',
310
  esc_attr( $taxonomy_link_url ),
311
  sprintf(
312
  esc_html__( 'Edit %s', 'custom-post-type-ui' ),
313
  esc_html( $taxonomy )
314
  ),
315
+ esc_attr( admin_url( 'admin.php?page=cptui_tools&action=get_code#' . $taxonomy ) ),
316
  esc_html__( 'Get code', 'custom-post-type-ui' )
317
  ); ?>
318
  </td>
323
  if ( in_array( $value, array( '1', '0' ) ) ) {
324
  echo esc_html( disp_boolean( $value ) );
325
  } else {
326
+ echo ( ! empty( $value ) ) ? esc_html( $value ) : '""';
327
  }
328
  echo '<br/>';
329
  } ?>
348
  );
349
  }
350
  } else {
351
+ printf(
352
+ '<span aria-hidden="true">—</span><span class="screen-reader-text">%s</span>',
353
+ esc_html__( 'No custom labels to display', 'custom-post-type-ui' )
354
+ );
355
  }
356
  ?>
357
  </td>
358
  <td>
359
+ <p><strong><?php esc_html_e( 'Archives file name examples.', 'custom-post-type-ui' ); ?></strong><br />
360
  taxonomy-<?php echo esc_html( $taxonomy ); ?>-term_slug.php *<br />
361
  taxonomy-<?php echo esc_html( $taxonomy ); ?>.php<br />
362
  taxonomy.php<br />
379
  $counter++;
380
  }
381
  ?>
382
+ </tbody>
383
+ <tfoot>
384
  <tr>
385
  <?php
386
  foreach ( $taxonomy_table_heads as $head ) {
387
  echo '<th>' . esc_html( $head ) . '</th>';
388
  } ?>
389
  </tr>
390
+ </tfoot>
391
  </table>
392
  <?php
393
  /**
inc/post-types.php CHANGED
@@ -49,8 +49,8 @@ add_action( 'admin_enqueue_scripts', 'cptui_post_type_enqueue_scripts' );
49
  *
50
  * @internal
51
  *
52
- * @param array $tabs Array of tabs to display.
53
- * @param string $current_page Current page being shown.
54
  * @return array Amended array of tabs to show.
55
  */
56
  function cptui_post_type_tabs( $tabs = array(), $current_page = '' ) {
@@ -59,7 +59,7 @@ function cptui_post_type_tabs( $tabs = array(), $current_page = '' ) {
59
  $post_types = cptui_get_post_type_data();
60
  $classes = array( 'nav-tab' );
61
 
62
- $tabs['page_title'] = __( 'Manage Post Types', 'custom-post-type-ui' );
63
  $tabs['tabs'] = array();
64
  // Start out with our basic "Add new" tab.
65
  $tabs['tabs']['add'] = array(
@@ -97,7 +97,7 @@ function cptui_post_type_tabs( $tabs = array(), $current_page = '' ) {
97
  $tabs['tabs']['export'] = array(
98
  'text' => __( 'Import/Export Post Types', 'custom-post-type-ui' ),
99
  'classes' => array( 'nav-tab' ), // Prevent notices.
100
- 'url' => esc_url( cptui_admin_url( 'admin.php?page=cptui_importexport' ) ),
101
  'aria-selected' => 'false',
102
  );
103
  }
@@ -211,7 +211,7 @@ function cptui_manage_post_types() {
211
  echo $ui->get_required_span();
212
 
213
  if ( 'edit' == $tab ) {
214
- echo '<p id="slugchanged" class="hidemessage">' . __( 'Slug has changed', 'custom_post_type_ui' ) . '</p>';
215
  }
216
 
217
  echo $ui->get_th_end() . $ui->get_td_start();
@@ -227,7 +227,7 @@ function cptui_manage_post_types() {
227
  'wrap' => false,
228
  ) );
229
  echo '<p class="cptui-slug-details">';
230
- esc_html_e( 'Slugs should only contain alphanumeric, latin characters. Underscores or dashes should be used in place of spaces.', 'custom-post-type-ui' );
231
  echo '</p>';
232
 
233
  if ( 'edit' == $tab ) {
@@ -410,6 +410,15 @@ function cptui_manage_post_types() {
410
  'aftertext' => esc_html__( '(e.g. View Movie)', 'custom-post-type-ui' ),
411
  ) );
412
 
 
 
 
 
 
 
 
 
 
413
  echo $ui->get_text_input( array(
414
  'labeltext' => esc_html__( 'Search Item', 'custom-post-type-ui' ),
415
  'helptext' => esc_html__( 'Used as the text for the search button on post type list screen.', 'custom-post-type-ui' ),
@@ -536,6 +545,15 @@ function cptui_manage_post_types() {
536
  'textvalue' => ( isset( $current['labels']['items_list'] ) ) ? esc_attr( $current['labels']['items_list'] ) : '',
537
  'aftertext' => esc_html__( '(e.g. Movies list)', 'custom-post-type-ui' ),
538
  ) );
 
 
 
 
 
 
 
 
 
539
  ?>
540
  </table>
541
  </div>
@@ -642,7 +660,7 @@ function cptui_manage_post_types() {
642
  ) );
643
 
644
  echo $ui->get_tr_start() . $ui->get_th_start();
645
- echo $ui->get_label( 'has_archive', __( 'Has Archive', 'custom-post-type-ui' ) );
646
  echo $ui->get_p( esc_html__( 'If left blank, the archive slug will default to the post type slug.', 'custom-post-type-ui' ) );
647
  echo $ui->get_th_end() . $ui->get_td_start();
648
 
@@ -860,7 +878,7 @@ function cptui_manage_post_types() {
860
 
861
  echo $ui->get_tr_start() . $ui->get_th_start() . esc_html__( 'Supports', 'custom-post-type-ui' );
862
 
863
- echo $ui->get_p( esc_html__( 'Add support for various available post editor features on the right.', 'custom_post_type_ui' ) );
864
 
865
  echo $ui->get_p( esc_html__( 'Use the "None" option to explicitly set "supports" to false.', 'custom-post-type-ui' ) );
866
 
@@ -1126,7 +1144,7 @@ function cptui_manage_post_types() {
1126
  *
1127
  * @since 1.0.0
1128
  *
1129
- * @param array $post_types Array of post types that are registered.
1130
  */
1131
  function cptui_post_types_dropdown( $post_types = array() ) {
1132
 
@@ -1160,8 +1178,7 @@ function cptui_post_types_dropdown( $post_types = array() ) {
1160
  *
1161
  * @internal
1162
  *
1163
- * @param bool $post_type_deleted Whether or not a post type was recently deleted.
1164
- *
1165
  * @return bool|string $value False on no result, sanitized post type if set.
1166
  */
1167
  function cptui_get_current_post_type( $post_type_deleted = false ) {
@@ -1204,8 +1221,7 @@ function cptui_get_current_post_type( $post_type_deleted = false ) {
1204
  *
1205
  * @internal
1206
  *
1207
- * @param array $data $_POST values.
1208
- *
1209
  * @return bool|string False on failure, string on success.
1210
  */
1211
  function cptui_delete_post_type( $data = array() ) {
@@ -1277,8 +1293,7 @@ function cptui_delete_post_type( $data = array() ) {
1277
  *
1278
  * @internal
1279
  *
1280
- * @param array $data Array of post type data to update.
1281
- *
1282
  * @return bool|string False on failure, string on success.
1283
  */
1284
  function cptui_update_post_type( $data = array() ) {
@@ -1510,8 +1525,8 @@ function cptui_reserved_post_types() {
1510
  *
1511
  * @internal
1512
  *
1513
- * @param string $original_slug Original post type slug.
1514
- * @param string $new_slug New post type slug.
1515
  */
1516
  function cptui_convert_post_type_posts( $original_slug = '', $new_slug = '' ) {
1517
  $args = array(
@@ -1535,10 +1550,9 @@ function cptui_convert_post_type_posts( $original_slug = '', $new_slug = '' ) {
1535
  *
1536
  * @since 1.3.0
1537
  *
1538
- * @param bool $slug_exists Whether or not the post type slug exists.
1539
- * @param string $post_type_slug The post type slug being saved.
1540
- * @param array $post_types Array of CPTUI-registered post types.
1541
- *
1542
  * @return bool
1543
  */
1544
  function cptui_check_existing_post_type_slugs( $slug_exists = false, $post_type_slug = '', $post_types = array() ) {
@@ -1558,8 +1572,10 @@ function cptui_check_existing_post_type_slugs( $slug_exists = false, $post_type_
1558
  return true;
1559
  }
1560
 
1561
- // Check if other plugins have registered this same slug.
1562
- $registered_post_types = get_post_types( array( '_builtin' => false, 'public' => false ) );
 
 
1563
  if ( in_array( $post_type_slug, $registered_post_types ) ) {
1564
  return true;
1565
  }
@@ -1574,7 +1590,7 @@ add_filter( 'cptui_post_type_slug_exists', 'cptui_check_existing_post_type_slugs
1574
  *
1575
  * @since 1.3.0
1576
  *
1577
- * @param string $post_type_slug The post type slug being saved.
1578
  * @return bool Whether or not the slug exists.
1579
  */
1580
  function cptui_check_page_slugs( $post_type_slug = '' ) {
49
  *
50
  * @internal
51
  *
52
+ * @param array $tabs Array of tabs to display. Optional.
53
+ * @param string $current_page Current page being shown. Optional. Default empty string.
54
  * @return array Amended array of tabs to show.
55
  */
56
  function cptui_post_type_tabs( $tabs = array(), $current_page = '' ) {
59
  $post_types = cptui_get_post_type_data();
60
  $classes = array( 'nav-tab' );
61
 
62
+ $tabs['page_title'] = get_admin_page_title();
63
  $tabs['tabs'] = array();
64
  // Start out with our basic "Add new" tab.
65
  $tabs['tabs']['add'] = array(
97
  $tabs['tabs']['export'] = array(
98
  'text' => __( 'Import/Export Post Types', 'custom-post-type-ui' ),
99
  'classes' => array( 'nav-tab' ), // Prevent notices.
100
+ 'url' => esc_url( cptui_admin_url( 'admin.php?page=cptui_tools' ) ),
101
  'aria-selected' => 'false',
102
  );
103
  }
211
  echo $ui->get_required_span();
212
 
213
  if ( 'edit' == $tab ) {
214
+ echo '<p id="slugchanged" class="hidemessage">' . esc_html__( 'Slug has changed', 'custom_post_type_ui' ) . '</p>';
215
  }
216
 
217
  echo $ui->get_th_end() . $ui->get_td_start();
227
  'wrap' => false,
228
  ) );
229
  echo '<p class="cptui-slug-details">';
230
+ esc_html_e( 'Slugs should only contain alphanumeric, latin characters. Underscores should be used in place of spaces. Set "Custom Rewrite Slug" field to make slug use dashes for URLs.', 'custom-post-type-ui' );
231
  echo '</p>';
232
 
233
  if ( 'edit' == $tab ) {
410
  'aftertext' => esc_html__( '(e.g. View Movie)', 'custom-post-type-ui' ),
411
  ) );
412
 
413
+ echo $ui->get_text_input( array(
414
+ 'labeltext' => esc_html__( 'View Items', 'custom-post-type-ui' ),
415
+ 'helptext' => esc_html__( 'Used in the admin bar when viewing editor screen for a published post in the post type.', 'custom-post-type-ui' ),
416
+ 'namearray' => 'cpt_labels',
417
+ 'name' => 'view_items',
418
+ 'textvalue' => ( isset( $current['labels']['view_items'] ) ) ? esc_attr( $current['labels']['view_items'] ) : '',
419
+ 'aftertext' => esc_html__( '(e.g. View Movies)', 'custom-post-type-ui' ),
420
+ ) );
421
+
422
  echo $ui->get_text_input( array(
423
  'labeltext' => esc_html__( 'Search Item', 'custom-post-type-ui' ),
424
  'helptext' => esc_html__( 'Used as the text for the search button on post type list screen.', 'custom-post-type-ui' ),
545
  'textvalue' => ( isset( $current['labels']['items_list'] ) ) ? esc_attr( $current['labels']['items_list'] ) : '',
546
  'aftertext' => esc_html__( '(e.g. Movies list)', 'custom-post-type-ui' ),
547
  ) );
548
+
549
+ echo $ui->get_text_input( array(
550
+ 'labeltext' => esc_html__( 'Attributes', 'custom-post-type-ui' ),
551
+ 'helptext' => esc_html__( 'Used for the title of the post attributes meta box.', 'custom-post-type-ui' ),
552
+ 'namearray' => 'cpt_labels',
553
+ 'name' => 'attributes',
554
+ 'textvalue' => ( isset( $current['labels']['attributes'] ) ) ? esc_attr( $current['labels']['attributes'] ) : '',
555
+ 'aftertext' => esc_html__( '(e.g. Movies Attributes)', 'custom-post-type-ui' ),
556
+ ) );
557
  ?>
558
  </table>
559
  </div>
660
  ) );
661
 
662
  echo $ui->get_tr_start() . $ui->get_th_start();
663
+ echo $ui->get_label( 'has_archive', esc_html__( 'Has Archive', 'custom-post-type-ui' ) );
664
  echo $ui->get_p( esc_html__( 'If left blank, the archive slug will default to the post type slug.', 'custom-post-type-ui' ) );
665
  echo $ui->get_th_end() . $ui->get_td_start();
666
 
878
 
879
  echo $ui->get_tr_start() . $ui->get_th_start() . esc_html__( 'Supports', 'custom-post-type-ui' );
880
 
881
+ echo $ui->get_p( esc_html__( 'Add support for various available post editor features on the right. A checked value means the post type means the feature is supported.', 'custom_post_type_ui' ) );
882
 
883
  echo $ui->get_p( esc_html__( 'Use the "None" option to explicitly set "supports" to false.', 'custom-post-type-ui' ) );
884
 
1144
  *
1145
  * @since 1.0.0
1146
  *
1147
+ * @param array $post_types Array of post types that are registered. Optional.
1148
  */
1149
  function cptui_post_types_dropdown( $post_types = array() ) {
1150
 
1178
  *
1179
  * @internal
1180
  *
1181
+ * @param bool $post_type_deleted Whether or not a post type was recently deleted. Optional. Default false.
 
1182
  * @return bool|string $value False on no result, sanitized post type if set.
1183
  */
1184
  function cptui_get_current_post_type( $post_type_deleted = false ) {
1221
  *
1222
  * @internal
1223
  *
1224
+ * @param array $data $_POST values. Optional.
 
1225
  * @return bool|string False on failure, string on success.
1226
  */
1227
  function cptui_delete_post_type( $data = array() ) {
1293
  *
1294
  * @internal
1295
  *
1296
+ * @param array $data Array of post type data to update. Optional.
 
1297
  * @return bool|string False on failure, string on success.
1298
  */
1299
  function cptui_update_post_type( $data = array() ) {
1525
  *
1526
  * @internal
1527
  *
1528
+ * @param string $original_slug Original post type slug. Optional. Default empty string.
1529
+ * @param string $new_slug New post type slug. Optional. Default empty string.
1530
  */
1531
  function cptui_convert_post_type_posts( $original_slug = '', $new_slug = '' ) {
1532
  $args = array(
1550
  *
1551
  * @since 1.3.0
1552
  *
1553
+ * @param bool $slug_exists Whether or not the post type slug exists. Optional. Default false.
1554
+ * @param string $post_type_slug The post type slug being saved. Optional. Default empty string.
1555
+ * @param array $post_types Array of CPTUI-registered post types. Optional.
 
1556
  * @return bool
1557
  */
1558
  function cptui_check_existing_post_type_slugs( $slug_exists = false, $post_type_slug = '', $post_types = array() ) {
1572
  return true;
1573
  }
1574
 
1575
+ // Check if other plugins have registered non-public this same slug.
1576
+ $public = get_post_types( array( '_builtin' => false, 'public' => true ) );
1577
+ $private = get_post_types( array( '_builtin' => false, 'public' => false ) );
1578
+ $registered_post_types = array_merge( $public, $private );
1579
  if ( in_array( $post_type_slug, $registered_post_types ) ) {
1580
  return true;
1581
  }
1590
  *
1591
  * @since 1.3.0
1592
  *
1593
+ * @param string $post_type_slug The post type slug being saved. Optional. Default empty string.
1594
  * @return bool Whether or not the slug exists.
1595
  */
1596
  function cptui_check_page_slugs( $post_type_slug = '' ) {
inc/support.php CHANGED
@@ -55,11 +55,12 @@ function cptui_support() {
55
 
56
  <h1><?php esc_html_e( 'Custom Post Type UI Support', 'custom-post-type-ui' ); ?></h1>
57
 
58
- <p><?php printf(
 
59
  esc_html__( 'Please note that %s this plugin will not handle display %s of registered post types or taxonomies in your current theme. It simply registers them for you. To display your data, check out %s. If all else fails, visit us on the %s', 'custom-post-type-ui' ),
60
  '<strong>',
61
  '</strong>',
62
- '<a href="https://pluginize.com/product/custom-post-type-ui-extended/?utm_source=faq&utm_medium=text&utm_campaign=cptui">' . esc_html__( 'CPTUI Extended' ) . '</a>',
63
  '<a href="https://www.wordpress.org/support/plugin/custom-post-type-ui/">' . esc_html__( 'Support Forums', 'custom-post-type-ui' ) . '</a>'
64
  ); ?></p>
65
 
@@ -85,11 +86,12 @@ function cptui_support() {
85
  </li>
86
  <li>
87
  <span tabindex="0" class="question" aria-controls="q4" aria-expanded="false"><?php esc_html_e( 'How can I remove the ads that suddenly started showing up?', 'custom-post-type-ui' ); ?></span>
88
- <div class="answer" id="q4"><?php
 
89
  printf(
90
  esc_html__( 'You can have them automatically removed from display via a purchased copy of %s.', 'custom-post-type-ui' ),
91
  sprintf( '<a href="%s">%s</a>',
92
- 'https://pluginize.com/product/custom-post-type-ui-extended/?utm_source=faq-remove&utm_medium=text&utm_campaign=cptui',
93
  'Custom Post Type UI Extended'
94
  )
95
  ); ?>
@@ -147,6 +149,13 @@ function cptui_support() {
147
  <a href="https://wordpress.org/support/topic/custom-post-type-and-visual-composer-grid-block?replies=11#post-7111458" target="_blank">https://wordpress.org/support/topic/custom-post-type-and-visual-composer-grid-block?replies=11#post-7111458</a>
148
  </div>
149
  </li>
 
 
 
 
 
 
 
150
  </ol>
151
  </td>
152
  </tr>
@@ -155,8 +164,9 @@ function cptui_support() {
155
  <h2><?php esc_html_e( 'Front-end Display', 'custom-post-type-ui' ); ?></h2>
156
  <ol id="questions_front">
157
  <li>
158
- <span tabindex="0" class="question" aria-controls="q14" aria-expanded="false"><?php esc_html_e( 'What template files should I edit to alter my post type display?', 'custom-post-type-ui' ); ?></span>
159
- <div class="answer" id="q14"><?php
 
160
  printf(
161
  esc_html__( 'Please visit the %sTemplate Hierarchy%s page on the WordPress codex for details about available templates.', 'custom-post-type-ui' ),
162
  '<a href="https://codex.wordpress.org/Template_Hierarchy" target="_blank">',
@@ -165,12 +175,13 @@ function cptui_support() {
165
  </div>
166
  </li>
167
  <li>
168
- <span tabindex="0" class="question" aria-controls="q15" aria-expanded="false"><?php esc_html_e( 'How do I display my custom post type on my site?', 'custom-post-type-ui' ); ?></span>
169
- <div class="answer" id="q15"><?php
 
170
  printf(
171
  esc_html__( 'We encourage checking out %s for easily displaying post type content wherever you can utilize a shortcode. If you prefer to handle on your own, you will need to utilize the %s class to handle display in custom locations. If you have set the post type to have archives, the archive url should be something like "http://www.mysite.com/post-type-slug"', 'custom-post-type-ui' ),
172
  sprintf( '<a href="%s">%s</a>',
173
- 'https://pluginize.com/product/custom-post-type-ui-extended/?utm_source=faq&utm_medium=text&utm_campaign=cptui',
174
  'Custom Post Type UI Extended'
175
  ),
176
  '<a href="https://codex.wordpress.org/Class_Reference/WP_Query" target="_blank">WP_Query</a>'
@@ -178,10 +189,13 @@ function cptui_support() {
178
  </div>
179
  </li>
180
  <li>
181
- <span tabindex="0" class="question" aria-controls="q16" aria-expanded="false"><?php esc_html_e( 'I have added categories and tags to my custom post type, but they do not appear in the archives.', 'custom-post-type-ui' ); ?></span>
182
- <div class="answer" id="q16"><?php printf( esc_html__( 'You will need to add your newly created post type to the types that the category and tag archives query for. You can see a tutorial on how to do that at %s', 'custom-post-type-ui' ),
183
- '<a href="https://wpmu.org/add-custom-post-types-to-tags-and-categories-in-wordpress/" target="_blank">https://wpmu.org/add-custom-post-types-to-tags-and-categories-in-wordpress/</a>'
184
- ); ?> </div>
 
 
 
185
  </li>
186
  </ol>
187
  </td>
@@ -189,8 +203,9 @@ function cptui_support() {
189
  <h2><?php esc_html_e( 'Advanced', 'custom-post-type-ui' ); ?></h2>
190
  <ol id="questions_advanced">
191
  <li>
192
- <span tabindex="0" class="question" aria-controls="q17" aria-expanded="false"><?php esc_html_e( 'How do I add custom metaboxes to my post type?', 'custom-post-type-ui' ); ?></span>
193
- <div class="answer" id="q17"><?php
 
194
  printf(
195
  esc_html__( 'We recommend checking out %s, the latest iteration of "Custom Metaboxes and Fields for WordPress". Both are maintained by WebDevStudios.', 'custom-post-type-ui' ),
196
  '<a href="https://wordpress.org/plugins/cmb2/" target="_blank">CMB2</a>'
@@ -198,8 +213,9 @@ function cptui_support() {
198
  </div>
199
  </li>
200
  <li>
201
- <span tabindex="0" class="question" aria-controls="q18" aria-expanded="false"><?php esc_html_e( 'How do I add a newly registered taxonomy to a post type that already exists?', 'custom-post-type-ui' ); ?></span>
202
- <div class="answer" id="q18"><?php
 
203
  printf(
204
  esc_html__( 'Check out the %s function for documentation and usage examples.', 'custom-post-type-ui' ),
205
  '<a href="https://codex.wordpress.org/Function_Reference/register_taxonomy_for_object_type" target="_blank">register_taxonomy_for_object_type()</a>'
@@ -207,8 +223,9 @@ function cptui_support() {
207
  </div>
208
  </li>
209
  <li>
210
- <span tabindex="0" class="question" aria-controls="q19" aria-expanded="false"><?php esc_html_e( 'Post relationships?', 'custom-post-type-ui' ); ?></span>
211
- <div class="answer" id="q19"><?php
 
212
  printf(
213
  esc_html__( '%s has an excellent %spost%s introducing users to the %sPosts 2 Posts%s plugin that should be a good start.', 'custom-post-type-ui' ),
214
  'Pippin Williamson',
@@ -219,13 +236,13 @@ function cptui_support() {
219
  ); ?></div>
220
  </li>
221
  <li>
222
- <span tabindex="0" class="question" aria-controls="q20" aria-expanded="false"><?php esc_html_e( 'Is there any function reference list?', 'custom-post-type-ui' ); ?></span>
223
- <div class="answer" id="q20"><?php printf( esc_html__( '%s has compiled a nice list of functions used by our plugin. Note not all will be useful as they are attached to hooks.', 'custom-post-type-ui' ),
224
- '<a href="http://hookr.io/plugins/custom-post-type-ui/1.0.5/all/#index=c" target="_blank">Hookr.io</a>' ); ?></div>
225
  </li>
226
  <li>
227
- <span tabindex="0" class="question" aria-controls="q21" aria-expanded="false"><?php esc_html_e( 'How do I filter the "enter title here" text in the post editor screen?', 'custom-post-type-ui' ); ?></span>
228
- <div class="answer" id="q21"><p><?php esc_html_e( 'Change text inside the post/page editor title field. Should be able to adapt as necessary.', 'custom-post-type-ui' ); ?></p>
229
  <pre><code>function my_custom_title_text( $title ){
230
  global $post;
231
  if ( 'ENTER POST TYPE SLUG HERE' == $post->post_type )
55
 
56
  <h1><?php esc_html_e( 'Custom Post Type UI Support', 'custom-post-type-ui' ); ?></h1>
57
 
58
+ <p>
59
+ <?php printf(
60
  esc_html__( 'Please note that %s this plugin will not handle display %s of registered post types or taxonomies in your current theme. It simply registers them for you. To display your data, check out %s. If all else fails, visit us on the %s', 'custom-post-type-ui' ),
61
  '<strong>',
62
  '</strong>',
63
+ '<a href="https://pluginize.com/plugins/custom-post-type-ui-extended/?utm_source=faq&utm_medium=text&utm_campaign=cptui">' . esc_html__( 'CPTUI Extended' ) . '</a>',
64
  '<a href="https://www.wordpress.org/support/plugin/custom-post-type-ui/">' . esc_html__( 'Support Forums', 'custom-post-type-ui' ) . '</a>'
65
  ); ?></p>
66
 
86
  </li>
87
  <li>
88
  <span tabindex="0" class="question" aria-controls="q4" aria-expanded="false"><?php esc_html_e( 'How can I remove the ads that suddenly started showing up?', 'custom-post-type-ui' ); ?></span>
89
+ <div class="answer" id="q4">
90
+ <?php
91
  printf(
92
  esc_html__( 'You can have them automatically removed from display via a purchased copy of %s.', 'custom-post-type-ui' ),
93
  sprintf( '<a href="%s">%s</a>',
94
+ 'https://pluginize.com/plugins/custom-post-type-ui-extended/?utm_source=faq-remove&utm_medium=text&utm_campaign=cptui',
95
  'Custom Post Type UI Extended'
96
  )
97
  ); ?>
149
  <a href="https://wordpress.org/support/topic/custom-post-type-and-visual-composer-grid-block?replies=11#post-7111458" target="_blank">https://wordpress.org/support/topic/custom-post-type-and-visual-composer-grid-block?replies=11#post-7111458</a>
150
  </div>
151
  </li>
152
+ <li>
153
+ <span tabindex="0" class="question" aria-controls="q14" aria-expanded="false"><?php esc_html_e( 'Why can I not use dashes in post type or taxonomy slugs?', 'custom-post-type-ui' ); ?></span>
154
+
155
+ <div class="answer" id="q14"><?php esc_html_e( 'CPTUI tries to make smart choices for our users, and forcing underscores is one of them. Please see the tutorial at the following URL for how to get dashes in your permalink urls while continuing to use underscores for the actual slug.', 'custom-post-type-ui' ); ?>
156
+ <a href="http://docs.pluginize.com/article/135-dashes-in-post-type-taxonomy-slugs-for-url-seo" target="_blank">http://docs.pluginize.com/article/135-dashes-in-post-type-taxonomy-slugs-for-url-seo</a>
157
+ </div>
158
+ </li>
159
  </ol>
160
  </td>
161
  </tr>
164
  <h2><?php esc_html_e( 'Front-end Display', 'custom-post-type-ui' ); ?></h2>
165
  <ol id="questions_front">
166
  <li>
167
+ <span tabindex="0" class="question" aria-controls="q15" aria-expanded="false"><?php esc_html_e( 'What template files should I edit to alter my post type display?', 'custom-post-type-ui' ); ?></span>
168
+ <div class="answer" id="q15">
169
+ <?php
170
  printf(
171
  esc_html__( 'Please visit the %sTemplate Hierarchy%s page on the WordPress codex for details about available templates.', 'custom-post-type-ui' ),
172
  '<a href="https://codex.wordpress.org/Template_Hierarchy" target="_blank">',
175
  </div>
176
  </li>
177
  <li>
178
+ <span tabindex="0" class="question" aria-controls="q16" aria-expanded="false"><?php esc_html_e( 'How do I display my custom post type on my site?', 'custom-post-type-ui' ); ?></span>
179
+ <div class="answer" id="q16">
180
+ <?php
181
  printf(
182
  esc_html__( 'We encourage checking out %s for easily displaying post type content wherever you can utilize a shortcode. If you prefer to handle on your own, you will need to utilize the %s class to handle display in custom locations. If you have set the post type to have archives, the archive url should be something like "http://www.mysite.com/post-type-slug"', 'custom-post-type-ui' ),
183
  sprintf( '<a href="%s">%s</a>',
184
+ 'https://pluginize.com/plugins/custom-post-type-ui-extended/?utm_source=faq&utm_medium=text&utm_campaign=cptui',
185
  'Custom Post Type UI Extended'
186
  ),
187
  '<a href="https://codex.wordpress.org/Class_Reference/WP_Query" target="_blank">WP_Query</a>'
189
  </div>
190
  </li>
191
  <li>
192
+ <span tabindex="0" class="question" aria-controls="q17" aria-expanded="false"><?php esc_html_e( 'I have added categories and tags to my custom post type, but they do not appear in the archives.', 'custom-post-type-ui' ); ?></span>
193
+ <div class="answer" id="q17">
194
+ <?php
195
+ printf(
196
+ esc_html__( 'You will need to add your newly created post type to the types that the category and tag archives query for. You can see a tutorial on how to do that at %s', 'custom-post-type-ui' ),
197
+ '<a href="http://docs.pluginize.com/article/17-post-types-in-category-tag-archives" target="_blank">http://docs.pluginize.com/article/17-post-types-in-category-tag-archives</a>'
198
+ ); ?> </div>
199
  </li>
200
  </ol>
201
  </td>
203
  <h2><?php esc_html_e( 'Advanced', 'custom-post-type-ui' ); ?></h2>
204
  <ol id="questions_advanced">
205
  <li>
206
+ <span tabindex="0" class="question" aria-controls="q18" aria-expanded="false"><?php esc_html_e( 'How do I add custom metaboxes to my post type?', 'custom-post-type-ui' ); ?></span>
207
+ <div class="answer" id="q18">
208
+ <?php
209
  printf(
210
  esc_html__( 'We recommend checking out %s, the latest iteration of "Custom Metaboxes and Fields for WordPress". Both are maintained by WebDevStudios.', 'custom-post-type-ui' ),
211
  '<a href="https://wordpress.org/plugins/cmb2/" target="_blank">CMB2</a>'
213
  </div>
214
  </li>
215
  <li>
216
+ <span tabindex="0" class="question" aria-controls="q19" aria-expanded="false"><?php esc_html_e( 'How do I add a newly registered taxonomy to a post type that already exists?', 'custom-post-type-ui' ); ?></span>
217
+ <div class="answer" id="q19">
218
+ <?php
219
  printf(
220
  esc_html__( 'Check out the %s function for documentation and usage examples.', 'custom-post-type-ui' ),
221
  '<a href="https://codex.wordpress.org/Function_Reference/register_taxonomy_for_object_type" target="_blank">register_taxonomy_for_object_type()</a>'
223
  </div>
224
  </li>
225
  <li>
226
+ <span tabindex="0" class="question" aria-controls="q20" aria-expanded="false"><?php esc_html_e( 'Post relationships?', 'custom-post-type-ui' ); ?></span>
227
+ <div class="answer" id="q20">
228
+ <?php
229
  printf(
230
  esc_html__( '%s has an excellent %spost%s introducing users to the %sPosts 2 Posts%s plugin that should be a good start.', 'custom-post-type-ui' ),
231
  'Pippin Williamson',
236
  ); ?></div>
237
  </li>
238
  <li>
239
+ <span tabindex="0" class="question" aria-controls="q21" aria-expanded="false"><?php esc_html_e( 'Is there any function reference list?', 'custom-post-type-ui' ); ?></span>
240
+ <div class="answer" id="q21"><?php printf( esc_html__( '%s has compiled a nice list of functions used by our plugin. Note not all will be useful as they are attached to hooks.', 'custom-post-type-ui' ),
241
+ '<a href="http://hookr.io/plugins/custom-post-type-ui/" target="_blank">Hookr.io</a>' ); ?></div>
242
  </li>
243
  <li>
244
+ <span tabindex="0" class="question" aria-controls="q22" aria-expanded="false"><?php esc_html_e( 'How do I filter the "enter title here" text in the post editor screen?', 'custom-post-type-ui' ); ?></span>
245
+ <div class="answer" id="q22"><p><?php esc_html_e( 'Change text inside the post/page editor title field. Should be able to adapt as necessary.', 'custom-post-type-ui' ); ?></p>
246
  <pre><code>function my_custom_title_text( $title ){
247
  global $post;
248
  if ( 'ENTER POST TYPE SLUG HERE' == $post->post_type )
inc/taxonomies.php CHANGED
@@ -49,8 +49,8 @@ add_action( 'admin_enqueue_scripts', 'cptui_taxonomies_enqueue_scripts' );
49
  *
50
  * @internal
51
  *
52
- * @param array $tabs Array of tabs to display.
53
- * @param string $current_page Current page being shown.
54
  * @return array Amended array of tabs to show.
55
  */
56
  function cptui_taxonomy_tabs( $tabs = array(), $current_page = '' ) {
@@ -59,7 +59,7 @@ function cptui_taxonomy_tabs( $tabs = array(), $current_page = '' ) {
59
  $taxonomies = cptui_get_taxonomy_data();
60
  $classes = array( 'nav-tab' );
61
 
62
- $tabs['page_title'] = esc_html__( 'Manage Taxonomies', 'custom-post-type-ui' );
63
  $tabs['tabs'] = array();
64
  // Start out with our basic "Add new" tab.
65
  $tabs['tabs']['add'] = array(
@@ -97,7 +97,7 @@ function cptui_taxonomy_tabs( $tabs = array(), $current_page = '' ) {
97
  $tabs['tabs']['export'] = array(
98
  'text' => esc_html__( 'Import/Export Taxonomies', 'custom-post-type-ui' ),
99
  'classes' => array( 'nav-tab' ), // Prevent notices.
100
- 'url' => esc_url( cptui_admin_url( 'admin.php?page=cptui_importexport&action=taxonomies' ) ),
101
  'aria-selected' => 'false',
102
  );
103
  }
@@ -915,7 +915,7 @@ function cptui_manage_taxonomies() {
915
  *
916
  * @since 1.0.0
917
  *
918
- * @param array $taxonomies Array of taxonomies that are registered.
919
  */
920
  function cptui_taxonomies_dropdown( $taxonomies = array() ) {
921
 
@@ -949,7 +949,7 @@ function cptui_taxonomies_dropdown( $taxonomies = array() ) {
949
  *
950
  * @internal
951
  *
952
- * @param bool $taxonomy_deleted Whether or not a taxonomy was recently deleted.
953
  * @return bool|string False on no result, sanitized taxonomy if set.
954
  */
955
  function cptui_get_current_taxonomy( $taxonomy_deleted = false ) {
@@ -992,7 +992,7 @@ function cptui_get_current_taxonomy( $taxonomy_deleted = false ) {
992
  *
993
  * @internal
994
  *
995
- * @param array $data The $_POST values.
996
  * @return bool|string False on failure, string on success.
997
  */
998
  function cptui_delete_taxonomy( $data = array() ) {
@@ -1064,7 +1064,7 @@ function cptui_delete_taxonomy( $data = array() ) {
1064
  *
1065
  * @internal
1066
  *
1067
- * @param array $data Array of taxonomy data to update.
1068
  * @return bool|string False on failure, string on success.
1069
  */
1070
  function cptui_update_taxonomy( $data = array() ) {
@@ -1227,6 +1227,7 @@ function cptui_update_taxonomy( $data = array() ) {
1227
  function cptui_reserved_taxonomies() {
1228
 
1229
  $reserved = array(
 
1230
  'attachment',
1231
  'attachment_id',
1232
  'author',
@@ -1336,18 +1337,19 @@ function cptui_reserved_taxonomies() {
1336
  *
1337
  * @internal
1338
  *
1339
- * @param string $original_slug Original taxonomy slug.
1340
- * @param string $new_slug New taxonomy slug.
1341
  */
1342
  function cptui_convert_taxonomy_terms( $original_slug = '', $new_slug = '' ) {
1343
  global $wpdb;
1344
 
1345
  $args = array(
 
1346
  'hide_empty' => false,
1347
  'fields' => 'ids',
1348
  );
1349
 
1350
- $term_ids = get_terms( $original_slug, $args );
1351
 
1352
  if ( is_int( $term_ids ) ) {
1353
  $term_ids = (array) $term_ids;
@@ -1370,9 +1372,9 @@ function cptui_convert_taxonomy_terms( $original_slug = '', $new_slug = '' ) {
1370
  *
1371
  * @since 1.3.0
1372
  *
1373
- * @param bool $slug_exists Whether or not the post type slug exists.
1374
- * @param string $taxonomy_slug The post type slug being saved.
1375
- * @param array $taxonomies Array of CPTUI-registered post types.
1376
  *
1377
  * @return bool
1378
  */
49
  *
50
  * @internal
51
  *
52
+ * @param array $tabs Array of tabs to display. Optional.
53
+ * @param string $current_page Current page being shown. Optional. Default empty string.
54
  * @return array Amended array of tabs to show.
55
  */
56
  function cptui_taxonomy_tabs( $tabs = array(), $current_page = '' ) {
59
  $taxonomies = cptui_get_taxonomy_data();
60
  $classes = array( 'nav-tab' );
61
 
62
+ $tabs['page_title'] = get_admin_page_title();
63
  $tabs['tabs'] = array();
64
  // Start out with our basic "Add new" tab.
65
  $tabs['tabs']['add'] = array(
97
  $tabs['tabs']['export'] = array(
98
  'text' => esc_html__( 'Import/Export Taxonomies', 'custom-post-type-ui' ),
99
  'classes' => array( 'nav-tab' ), // Prevent notices.
100
+ 'url' => esc_url( cptui_admin_url( 'admin.php?page=cptui_tools&action=taxonomies' ) ),
101
  'aria-selected' => 'false',
102
  );
103
  }
915
  *
916
  * @since 1.0.0
917
  *
918
+ * @param array $taxonomies Array of taxonomies that are registered. Optional.
919
  */
920
  function cptui_taxonomies_dropdown( $taxonomies = array() ) {
921
 
949
  *
950
  * @internal
951
  *
952
+ * @param bool $taxonomy_deleted Whether or not a taxonomy was recently deleted. Optional. Default false.
953
  * @return bool|string False on no result, sanitized taxonomy if set.
954
  */
955
  function cptui_get_current_taxonomy( $taxonomy_deleted = false ) {
992
  *
993
  * @internal
994
  *
995
+ * @param array $data The $_POST values. Optional.
996
  * @return bool|string False on failure, string on success.
997
  */
998
  function cptui_delete_taxonomy( $data = array() ) {
1064
  *
1065
  * @internal
1066
  *
1067
+ * @param array $data Array of taxonomy data to update. Optional.
1068
  * @return bool|string False on failure, string on success.
1069
  */
1070
  function cptui_update_taxonomy( $data = array() ) {
1227
  function cptui_reserved_taxonomies() {
1228
 
1229
  $reserved = array(
1230
+ 'action',
1231
  'attachment',
1232
  'attachment_id',
1233
  'author',
1337
  *
1338
  * @internal
1339
  *
1340
+ * @param string $original_slug Original taxonomy slug. Optional. Default empty string.
1341
+ * @param string $new_slug New taxonomy slug. Optional. Default empty string.
1342
  */
1343
  function cptui_convert_taxonomy_terms( $original_slug = '', $new_slug = '' ) {
1344
  global $wpdb;
1345
 
1346
  $args = array(
1347
+ 'taxonomy' => $original_slug,
1348
  'hide_empty' => false,
1349
  'fields' => 'ids',
1350
  );
1351
 
1352
+ $term_ids = get_terms( $args );
1353
 
1354
  if ( is_int( $term_ids ) ) {
1355
  $term_ids = (array) $term_ids;
1372
  *
1373
  * @since 1.3.0
1374
  *
1375
+ * @param bool $slug_exists Whether or not the post type slug exists. Optional. Default false.
1376
+ * @param string $taxonomy_slug The post type slug being saved. Optional. Default empty string.
1377
+ * @param array $taxonomies Array of CPTUI-registered post types. Optional.
1378
  *
1379
  * @return bool
1380
  */
inc/{import_export.php → tools.php} RENAMED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
- * Custom Post Type UI Import/Export.
4
  *
5
  * @package CPTUI
6
- * @subpackage ImportExport
7
  * @author WebDevStudios
8
  * @since 1.0.0
9
  */
@@ -14,22 +14,23 @@ if ( ! defined( 'ABSPATH' ) ) {
14
  }
15
 
16
  /**
17
- * Register our tabs for the Import/Export screen.
18
  *
19
  * @since 1.3.0
 
20
  *
21
  * @internal
22
  *
23
- * @param array $tabs Array of tabs to display.
24
- * @param string $current_page Current page being shown.
25
  * @return array Amended array of tabs to show.
26
  */
27
- function cptui_importexport_tabs( $tabs = array(), $current_page = '' ) {
28
 
29
- if ( 'importexport' == $current_page ) {
30
  $classes = array( 'nav-tab' );
31
 
32
- $tabs['page_title'] = __( 'Import/Export', 'custom-post-type-ui' );
33
  $tabs['tabs'] = array();
34
  $tabs['tabs']['post_types'] = array(
35
  'text' => __( 'Post Types', 'custom-post-type-ui' ),
@@ -76,11 +77,22 @@ function cptui_importexport_tabs( $tabs = array(), $current_page = '' ) {
76
  $tabs['tabs']['post_types']['classes'][] = $active_class;
77
  $tabs['tabs']['post_types']['aria-selected'] = 'true';
78
  }
 
 
 
 
 
 
 
 
 
 
 
79
  }
80
 
81
  return $tabs;
82
  }
83
- add_filter( 'cptui_get_tabs', 'cptui_importexport_tabs', 10, 2 );
84
 
85
  /**
86
  * Create our settings page output.
@@ -89,39 +101,41 @@ add_filter( 'cptui_get_tabs', 'cptui_importexport_tabs', 10, 2 );
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
-
111
- if ( isset( $notice ) ) {
112
- echo $notice;
113
- }
114
  echo '<div class="wrap">';
115
 
116
  /**
117
  * Fires right inside the wrap div for the import/export pages.
118
  *
119
  * @since 1.3.0
 
 
 
 
 
 
 
 
 
120
  */
121
- do_action( 'cptui_inside_importexport_wrap' );
122
 
123
  // Create our tabs.
124
- cptui_settings_tab_menu( $page = 'importexport' );
125
 
126
  /**
127
  * Fires inside the markup for the import/export section.
@@ -130,9 +144,23 @@ function cptui_importexport() {
130
  *
131
  * @since 1.2.0
132
  *
 
 
 
 
 
 
 
 
 
 
 
 
 
133
  * @param string $tab Current tab being displayed.
134
  */
135
- do_action( 'cptui_import_export_sections', $tab );
 
136
 
137
  echo '</div><!-- End .wrap -->';
138
  }
@@ -144,8 +172,8 @@ function cptui_importexport() {
144
  * @since 1.2.0 Added $cptui_taxonomies parameter.
145
  * @since 1.2.0 Added $single parameter.
146
  *
147
- * @param array $cptui_taxonomies Array of taxonomies to render.
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 ) ) {
@@ -155,14 +183,14 @@ function cptui_get_taxonomy_code( $cptui_taxonomies = array(), $single = false )
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; ?>()
165
  }
 
 
166
  <?php
167
  } else {
168
  _e( 'No taxonomies to display at this time', 'custom-post-type-ui' );
@@ -174,7 +202,7 @@ function <?php echo $callback; ?>() {
174
  *
175
  * @since 1.0.0
176
  *
177
- * @param array $taxonomy Taxonomy data to output.
178
  */
179
  function cptui_get_single_taxonomy_registery( $taxonomy = array() ) {
180
 
@@ -227,16 +255,23 @@ function cptui_get_single_taxonomy_registery( $taxonomy = array() ) {
227
 
228
  $my_theme = wp_get_theme();
229
  $textdomain = $my_theme->get( 'TextDomain' );
230
- ?>
 
 
 
 
 
231
  $labels = array(
232
  "name" => __( '<?php echo $taxonomy['label']; ?>', '<?php echo $textdomain; ?>' ),
233
  "singular_name" => __( '<?php echo $taxonomy['singular_label']; ?>', '<?php echo $textdomain; ?>' ),
234
- <?php
235
- foreach ( $taxonomy['labels'] as $key => $label ) {
236
- if ( ! empty( $label ) ) {
237
- echo '"' . $key . '" => __( \'' . $label . '\', \'' . $textdomain . '\' ),' . "\n\t\t";
238
- }
239
- } ?>);
 
 
240
 
241
  $args = array(
242
  "label" => __( '<?php echo $taxonomy['label']; ?>', '<?php echo $textdomain; ?>' ),
@@ -265,8 +300,8 @@ function cptui_get_single_taxonomy_registery( $taxonomy = array() ) {
265
  * @since 1.2.0 Added $cptui_post_types parameter.
266
  * @since 1.2.0 Added $single parameter.
267
  *
268
- * @param array $cptui_post_types Array of post types to render.
269
- * @param bool $single Whether or not we are rendering a single post type.
270
  */
271
  function cptui_get_post_type_code( $cptui_post_types = array(), $single = false ) {
272
  // Whitespace very much matters here, thus why it's all flush against the left side.
@@ -276,15 +311,17 @@ function cptui_get_post_type_code( $cptui_post_types = array(), $single = false
276
  $key = key( $cptui_post_types );
277
  $callback = 'cptui_register_my_cpts_' . str_replace( '-', '_', $cptui_post_types[ $key ]['name'] );
278
  }
279
- ?>
280
- add_action( 'init', '<?php echo $callback; ?>' );
281
  function <?php echo $callback; ?>() {
282
  <?php // Space before this line reflects in textarea.
283
- foreach ( $cptui_post_types as $type ) {
284
- echo cptui_get_single_post_type_registery( $type ) . "\n";
285
- } ?>
286
- // End of <?php echo $callback; ?>()
287
  }
 
 
288
  <?php
289
  } else {
290
  _e( 'No post types to display at this time', 'custom-post-type-ui' );
@@ -296,7 +333,7 @@ function <?php echo $callback; ?>() {
296
  *
297
  * @since 1.0.0
298
  *
299
- * @param array $post_type Post type data to output.
300
  */
301
  function cptui_get_single_post_type_registery( $post_type = array() ) {
302
 
@@ -346,6 +383,15 @@ function cptui_get_single_post_type_registery( $post_type = array() ) {
346
  } else {
347
  $rewrite = disp_boolean( $post_type['rewrite'] );
348
  }
 
 
 
 
 
 
 
 
 
349
 
350
  $supports = '';
351
  // Do a little bit of php work to get these into strings.
@@ -377,20 +423,28 @@ function cptui_get_single_post_type_registery( $post_type = array() ) {
377
 
378
  $my_theme = wp_get_theme();
379
  $textdomain = $my_theme->get( 'TextDomain' );
380
- ?>
 
 
 
 
 
381
  $labels = array(
382
  "name" => __( '<?php echo $post_type['label']; ?>', '<?php echo $textdomain; ?>' ),
383
  "singular_name" => __( '<?php echo $post_type['singular_label']; ?>', '<?php echo $textdomain; ?>' ),
384
- <?php foreach ( $post_type['labels'] as $key => $label ) {
385
- if ( ! empty( $label ) ) {
386
- if ( 'parent' === $key ) {
387
- // Fix for incorrect label key. See #439.
388
- echo '"' . 'parent_item_colon' . '" => __( \'' . $label . '\', \'' . $textdomain . '\' ),' . "\n\t\t";
389
- } else {
390
- echo '"' . $key . '" => __( \'' . $label . '\', \'' . $textdomain . '\' ),' . "\n\t\t";
391
- }
392
  }
393
- } ?>);
 
 
 
394
 
395
  $args = array(
396
  "label" => __( '<?php echo $post_type['label']; ?>', '<?php echo $textdomain; ?>' ),
@@ -401,9 +455,10 @@ function cptui_get_single_post_type_registery( $post_type = array() ) {
401
  "show_ui" => <?php echo disp_boolean( $post_type['show_ui'] ); ?>,
402
  "show_in_rest" => <?php echo disp_boolean( $post_type['show_in_rest'] ); ?>,
403
  "rest_base" => "<?php echo $post_type['rest_base']; ?>",
404
- "has_archive" => <?php echo disp_boolean( $post_type['has_archive'] ); ?>,
405
  "show_in_menu" => <?php echo disp_boolean( $post_type['show_in_menu'] ); ?>,
406
- <?php if ( ! empty( $post_type['show_in_menu_string'] ) ) { ?>"show_in_menu_string" => "<?php echo $post_type['show_in_menu_string']; ?>",
 
407
  <?php } ?>
408
  "exclude_from_search" => <?php echo disp_boolean( $post_type['exclude_from_search'] ); ?>,
409
  "capability_type" => "<?php echo $post_type['capability_type']; ?>",
@@ -411,13 +466,23 @@ function cptui_get_single_post_type_registery( $post_type = array() ) {
411
  "hierarchical" => <?php echo disp_boolean( $post_type['hierarchical'] ); ?>,
412
  "rewrite" => <?php echo $rewrite; ?>,
413
  "query_var" => <?php echo $post_type['query_var']; ?>,
414
- <?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 } ?>
415
- <?php if ( ! empty( $supports ) ) { echo "\n\t\t" ?>"supports" => <?php echo $supports; ?>,<?php } ?>
416
- <?php if ( ! empty( $taxonomies ) ) { echo "\n\t\t" ?>"taxonomies" => <?php echo $taxonomies; ?>,
 
 
 
 
 
 
 
 
417
  <?php } ?>
418
- <?php if ( true === $yarpp ) { echo "\n\t\t" ?>"yarpp_support" => <?php echo disp_boolean( $yarpp ); ?>,
 
419
  <?php } ?>
420
  );
 
421
  register_post_type( "<?php echo $post_type['name']; ?>", $args );
422
  <?php
423
  }
@@ -429,7 +494,7 @@ function cptui_get_single_post_type_registery( $post_type = array() ) {
429
  *
430
  * @internal
431
  *
432
- * @param array $postdata $_POST data as json.
433
  * @return mixed false on nothing to do, otherwise void.
434
  */
435
  function cptui_import_types_taxes_settings( $postdata = array() ) {
@@ -437,6 +502,7 @@ function cptui_import_types_taxes_settings( $postdata = array() ) {
437
  return false;
438
  }
439
 
 
440
  $success = false;
441
 
442
  /**
@@ -486,10 +552,8 @@ function cptui_import_types_taxes_settings( $postdata = array() ) {
486
  * @param array $postdata Post type data.
487
  */
488
  if ( false === ( $success = apply_filters( 'cptui_post_type_import_delete_save', false, $postdata ) ) ) {
489
- delete_option( 'cptui_post_types' );
490
  }
491
- // We're technically successful in a sense. Importing nothing.
492
- $success = true;
493
  }
494
 
495
  if ( $settings ) {
@@ -514,8 +578,10 @@ function cptui_import_types_taxes_settings( $postdata = array() ) {
514
  }
515
  // Used to help flush rewrite rules on init.
516
  set_transient( 'cptui_flush_rewrite_rules', 'true', 5 * 60 );
517
- return cptui_admin_notices( 'import', __( 'Post types', 'custom-post-type-ui' ), $success );
518
 
 
 
 
519
  } elseif ( ! empty( $postdata['cptui_tax_import'] ) ) {
520
  $tax_data = stripslashes_deep( trim( $postdata['cptui_tax_import'] ) );
521
  $settings = json_decode( $tax_data, true );
@@ -533,10 +599,8 @@ function cptui_import_types_taxes_settings( $postdata = array() ) {
533
  * @param array $postdata Taxonomy data
534
  */
535
  if ( false === ( $success = apply_filters( 'cptui_taxonomy_import_delete_save', false, $postdata ) ) ) {
536
- delete_option( 'cptui_taxonomies' );
537
  }
538
- // We're technically successful in a sense. Importing nothing.
539
- $success = true;
540
  }
541
 
542
  if ( $settings ) {
@@ -560,14 +624,16 @@ function cptui_import_types_taxes_settings( $postdata = array() ) {
560
  }
561
  // Used to help flush rewrite rules on init.
562
  set_transient( 'cptui_flush_rewrite_rules', 'true', 5 * 60 );
563
- return cptui_admin_notices( 'import', __( 'Taxonomies', 'custom-post-type-ui' ), $success );
 
 
564
  }
565
 
566
- return $success;
567
  }
568
 
569
  /**
570
- * Content for the Post Types/Taxonomies Import/Export tab.
571
  *
572
  * @since 1.2.0
573
  *
@@ -756,7 +822,7 @@ function cptui_render_debuginfo_section() {
756
  }
757
 
758
  /**
759
- * Renders various tab sections for the Import/Export page, based on current tab.
760
  *
761
  * @since 1.2.0
762
  *
@@ -764,7 +830,7 @@ function cptui_render_debuginfo_section() {
764
  *
765
  * @param string $tab Current tab to display.
766
  */
767
- function cptui_render_importexportsections( $tab ) {
768
  if ( isset( $tab ) ) {
769
  if ( 'post_types' == $tab || 'taxonomies' == $tab ) {
770
  cptui_render_posttypes_taxonomies_section();
@@ -779,4 +845,21 @@ function cptui_render_importexportsections( $tab ) {
779
  }
780
  }
781
  }
782
- add_action( 'cptui_import_export_sections', 'cptui_render_importexportsections' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <?php
2
  /**
3
+ * Custom Post Type UI Tools.
4
  *
5
  * @package CPTUI
6
+ * @subpackage Tools
7
  * @author WebDevStudios
8
  * @since 1.0.0
9
  */
14
  }
15
 
16
  /**
17
+ * Register our tabs for the Tools screen.
18
  *
19
  * @since 1.3.0
20
+ * @since 1.5.0 Renamed to "Tools"
21
  *
22
  * @internal
23
  *
24
+ * @param array $tabs Array of tabs to display. Optional.
25
+ * @param string $current_page Current page being shown. Optional. Default empty string.
26
  * @return array Amended array of tabs to show.
27
  */
28
+ function cptui_tools_tabs( $tabs = array(), $current_page = '' ) {
29
 
30
+ if ( 'tools' === $current_page ) {
31
  $classes = array( 'nav-tab' );
32
 
33
+ $tabs['page_title'] = get_admin_page_title();
34
  $tabs['tabs'] = array();
35
  $tabs['tabs']['post_types'] = array(
36
  'text' => __( 'Post Types', 'custom-post-type-ui' ),
77
  $tabs['tabs']['post_types']['classes'][] = $active_class;
78
  $tabs['tabs']['post_types']['aria-selected'] = 'true';
79
  }
80
+
81
+ /**
82
+ * Filters the tabs being added for the tools area.
83
+ *
84
+ * @since 1.5.0
85
+ *
86
+ * @param array $tabs Array of tabs to show.
87
+ * @param string $action Current tab being shown.
88
+ * @param string $active_class Class to use to mark the tab active.
89
+ */
90
+ $tabs = apply_filters( 'cptui_tools_tabs', $tabs, $action, $active_class );
91
  }
92
 
93
  return $tabs;
94
  }
95
+ add_filter( 'cptui_get_tabs', 'cptui_tools_tabs', 10, 2 );
96
 
97
  /**
98
  * Create our settings page output.
101
  *
102
  * @internal
103
  */
104
+ function cptui_tools() {
105
 
106
  $tab = '';
107
  if ( ! empty( $_GET ) ) {
108
+ if ( ! empty( $_GET['action'] ) && 'taxonomies' === $_GET['action'] ) {
109
  $tab = 'taxonomies';
110
+ } elseif ( ! empty( $_GET['action'] ) && 'get_code' === $_GET['action'] ) {
111
  $tab = 'get_code';
112
+ } elseif ( ! empty( $_GET['action'] ) && 'debuginfo' === $_GET['action'] ) {
113
  $tab = 'debuginfo';
114
  } else {
115
  $tab = 'post_types';
116
  }
117
  }
118
 
 
 
 
 
 
 
 
119
  echo '<div class="wrap">';
120
 
121
  /**
122
  * Fires right inside the wrap div for the import/export pages.
123
  *
124
  * @since 1.3.0
125
+ *
126
+ * @deprecated 1.5.0
127
+ */
128
+ do_action_deprecated( 'cptui_inside_importexport_wrap', array(), '1.5.0', 'cptui_inside_tools_wrap' );
129
+
130
+ /**
131
+ * Fires right inside the wrap div for the tools pages.
132
+ *
133
+ * @since 1.5.0
134
  */
135
+ do_action( 'cptui_inside_tools_wrap' );
136
 
137
  // Create our tabs.
138
+ cptui_settings_tab_menu( $page = 'tools' );
139
 
140
  /**
141
  * Fires inside the markup for the import/export section.
144
  *
145
  * @since 1.2.0
146
  *
147
+ * @deprecated 1.5.0
148
+ *
149
+ * @param string $tab Current tab being displayed.
150
+ */
151
+ do_action_deprecated( 'cptui_import_export_sections', array( $tab ), '1.5.0', 'cptui_tools_sections' );
152
+
153
+ /**
154
+ * Fires inside the markup for the tools section.
155
+ *
156
+ * Allows for more modular control and adding more sections more easily.
157
+ *
158
+ * @since 1.5.0
159
+ *
160
  * @param string $tab Current tab being displayed.
161
  */
162
+ do_action( 'cptui_tools_sections', $tab );
163
+
164
 
165
  echo '</div><!-- End .wrap -->';
166
  }
172
  * @since 1.2.0 Added $cptui_taxonomies parameter.
173
  * @since 1.2.0 Added $single parameter.
174
  *
175
+ * @param array $cptui_taxonomies Array of taxonomies to render. Optional.
176
+ * @param bool $single Whether or not we are rendering a single taxonomy. Optional. Default false.
177
  */
178
  function cptui_get_taxonomy_code( $cptui_taxonomies = array(), $single = false ) {
179
  if ( ! empty( $cptui_taxonomies ) ) {
183
  $callback = 'cptui_register_my_taxes_' . str_replace( '-', '_', $cptui_taxonomies[ $key ]['name'] );
184
  }
185
  ?>
 
186
  function <?php echo $callback; ?>() {
187
  <?php
188
  foreach ( $cptui_taxonomies as $tax ) {
189
+ echo cptui_get_single_taxonomy_registery( $tax );
190
  } ?>
 
191
  }
192
+
193
+ add_action( 'init', '<?php echo $callback; ?>' );
194
  <?php
195
  } else {
196
  _e( 'No taxonomies to display at this time', 'custom-post-type-ui' );
202
  *
203
  * @since 1.0.0
204
  *
205
+ * @param array $taxonomy Taxonomy data to output. Optional.
206
  */
207
  function cptui_get_single_taxonomy_registery( $taxonomy = array() ) {
208
 
255
 
256
  $my_theme = wp_get_theme();
257
  $textdomain = $my_theme->get( 'TextDomain' );
258
+ ?>
259
+
260
+ /**
261
+ * Taxonomy: <?php echo $taxonomy['label']; ?>.
262
+ */
263
+
264
  $labels = array(
265
  "name" => __( '<?php echo $taxonomy['label']; ?>', '<?php echo $textdomain; ?>' ),
266
  "singular_name" => __( '<?php echo $taxonomy['singular_label']; ?>', '<?php echo $textdomain; ?>' ),
267
+ <?php
268
+ foreach ( $taxonomy['labels'] as $key => $label ) {
269
+ if ( ! empty( $label ) ) {
270
+ echo "\t\t" . '"' . $key . '" => __( \'' . $label . '\', \'' . $textdomain . '\' ),' . "\n";
271
+ }
272
+ }
273
+ ?>
274
+ );
275
 
276
  $args = array(
277
  "label" => __( '<?php echo $taxonomy['label']; ?>', '<?php echo $textdomain; ?>' ),
300
  * @since 1.2.0 Added $cptui_post_types parameter.
301
  * @since 1.2.0 Added $single parameter.
302
  *
303
+ * @param array $cptui_post_types Array of post types to render. Optional.
304
+ * @param bool $single Whether or not we are rendering a single post type. Optional. Default false.
305
  */
306
  function cptui_get_post_type_code( $cptui_post_types = array(), $single = false ) {
307
  // Whitespace very much matters here, thus why it's all flush against the left side.
311
  $key = key( $cptui_post_types );
312
  $callback = 'cptui_register_my_cpts_' . str_replace( '-', '_', $cptui_post_types[ $key ]['name'] );
313
  }
314
+ ?>
315
+
316
  function <?php echo $callback; ?>() {
317
  <?php // Space before this line reflects in textarea.
318
+ foreach ( $cptui_post_types as $type ) {
319
+ echo cptui_get_single_post_type_registery( $type );
320
+ }
321
+ ?>
322
  }
323
+
324
+ add_action( 'init', '<?php echo $callback; ?>' );
325
  <?php
326
  } else {
327
  _e( 'No post types to display at this time', 'custom-post-type-ui' );
333
  *
334
  * @since 1.0.0
335
  *
336
+ * @param array $post_type Post type data to output. Optional.
337
  */
338
  function cptui_get_single_post_type_registery( $post_type = array() ) {
339
 
383
  } else {
384
  $rewrite = disp_boolean( $post_type['rewrite'] );
385
  }
386
+ $has_archive = get_disp_boolean( $post_type['has_archive'] );
387
+ if ( false !== $has_archive ) {
388
+ $has_archive = disp_boolean( $post_type['has_archive'] );
389
+ if ( ! empty( $post_type['has_archive_string'] ) ) {
390
+ $has_archive = '"' . $post_type['has_archive_string'] . '"';
391
+ }
392
+ } else {
393
+ $has_archive = disp_boolean( $post_type['has_archive'] );
394
+ }
395
 
396
  $supports = '';
397
  // Do a little bit of php work to get these into strings.
423
 
424
  $my_theme = wp_get_theme();
425
  $textdomain = $my_theme->get( 'TextDomain' );
426
+ ?>
427
+
428
+ /**
429
+ * Post Type: <?php echo $post_type['label']; ?>.
430
+ */
431
+
432
  $labels = array(
433
  "name" => __( '<?php echo $post_type['label']; ?>', '<?php echo $textdomain; ?>' ),
434
  "singular_name" => __( '<?php echo $post_type['singular_label']; ?>', '<?php echo $textdomain; ?>' ),
435
+ <?php
436
+ foreach ( $post_type['labels'] as $key => $label ) {
437
+ if ( ! empty( $label ) ) {
438
+ if ( 'parent' === $key ) {
439
+ // Fix for incorrect label key. See #439.
440
+ echo "\t\t" . '"' . 'parent_item_colon' . '" => __( \'' . $label . '\', \'' . $textdomain . '\' ),' . "\n";
441
+ } else {
442
+ echo "\t\t" . '"' . $key . '" => __( \'' . $label . '\', \'' . $textdomain . '\' ),' . "\n";
443
  }
444
+ }
445
+ }
446
+ ?>
447
+ );
448
 
449
  $args = array(
450
  "label" => __( '<?php echo $post_type['label']; ?>', '<?php echo $textdomain; ?>' ),
455
  "show_ui" => <?php echo disp_boolean( $post_type['show_ui'] ); ?>,
456
  "show_in_rest" => <?php echo disp_boolean( $post_type['show_in_rest'] ); ?>,
457
  "rest_base" => "<?php echo $post_type['rest_base']; ?>",
458
+ "has_archive" => <?php echo $has_archive; ?>,
459
  "show_in_menu" => <?php echo disp_boolean( $post_type['show_in_menu'] ); ?>,
460
+ <?php if ( ! empty( $post_type['show_in_menu_string'] ) ) { ?>
461
+ "show_in_menu_string" => "<?php echo $post_type['show_in_menu_string']; ?>",
462
  <?php } ?>
463
  "exclude_from_search" => <?php echo disp_boolean( $post_type['exclude_from_search'] ); ?>,
464
  "capability_type" => "<?php echo $post_type['capability_type']; ?>",
466
  "hierarchical" => <?php echo disp_boolean( $post_type['hierarchical'] ); ?>,
467
  "rewrite" => <?php echo $rewrite; ?>,
468
  "query_var" => <?php echo $post_type['query_var']; ?>,
469
+ <?php if ( ! empty( $post_type['menu_position'] ) ) { ?>
470
+ "menu_position" => <?php echo $post_type['menu_position']; ?>,
471
+ <?php } ?>
472
+ <?php if ( ! empty( $post_type['menu_icon'] ) ) { ?>
473
+ "menu_icon" => "<?php echo $post_type['menu_icon']; ?>",
474
+ <?php } ?>
475
+ <?php if ( ! empty( $supports ) ) { ?>
476
+ "supports" => <?php echo $supports; ?>,
477
+ <?php } ?>
478
+ <?php if ( ! empty( $taxonomies ) ) { ?>
479
+ "taxonomies" => <?php echo $taxonomies; ?>,
480
  <?php } ?>
481
+ <?php if ( true === $yarpp ) { ?>
482
+ "yarpp_support" => <?php echo disp_boolean( $yarpp ); ?>,
483
  <?php } ?>
484
  );
485
+
486
  register_post_type( "<?php echo $post_type['name']; ?>", $args );
487
  <?php
488
  }
494
  *
495
  * @internal
496
  *
497
+ * @param array $postdata $_POST data as json. Optional.
498
  * @return mixed false on nothing to do, otherwise void.
499
  */
500
  function cptui_import_types_taxes_settings( $postdata = array() ) {
502
  return false;
503
  }
504
 
505
+ $status = 'import_fail';
506
  $success = false;
507
 
508
  /**
552
  * @param array $postdata Post type data.
553
  */
554
  if ( false === ( $success = apply_filters( 'cptui_post_type_import_delete_save', false, $postdata ) ) ) {
555
+ $success = delete_option( 'cptui_post_types' );
556
  }
 
 
557
  }
558
 
559
  if ( $settings ) {
578
  }
579
  // Used to help flush rewrite rules on init.
580
  set_transient( 'cptui_flush_rewrite_rules', 'true', 5 * 60 );
 
581
 
582
+ if ( $success ) {
583
+ $status = 'import_success';
584
+ }
585
  } elseif ( ! empty( $postdata['cptui_tax_import'] ) ) {
586
  $tax_data = stripslashes_deep( trim( $postdata['cptui_tax_import'] ) );
587
  $settings = json_decode( $tax_data, true );
599
  * @param array $postdata Taxonomy data
600
  */
601
  if ( false === ( $success = apply_filters( 'cptui_taxonomy_import_delete_save', false, $postdata ) ) ) {
602
+ $success = delete_option( 'cptui_taxonomies' );
603
  }
 
 
604
  }
605
 
606
  if ( $settings ) {
624
  }
625
  // Used to help flush rewrite rules on init.
626
  set_transient( 'cptui_flush_rewrite_rules', 'true', 5 * 60 );
627
+ if ( $success ) {
628
+ $status = 'import_success';
629
+ }
630
  }
631
 
632
+ return $status;
633
  }
634
 
635
  /**
636
+ * Content for the Post Types/Taxonomies Tools tab.
637
  *
638
  * @since 1.2.0
639
  *
822
  }
823
 
824
  /**
825
+ * Renders various tab sections for the Tools page, based on current tab.
826
  *
827
  * @since 1.2.0
828
  *
830
  *
831
  * @param string $tab Current tab to display.
832
  */
833
+ function cptui_render_tools( $tab ) {
834
  if ( isset( $tab ) ) {
835
  if ( 'post_types' == $tab || 'taxonomies' == $tab ) {
836
  cptui_render_posttypes_taxonomies_section();
845
  }
846
  }
847
  }
848
+ add_action( 'cptui_tools_sections', 'cptui_render_tools' );
849
+
850
+ /**
851
+ * Handle the import of transferred post types and taxonomies.
852
+ *
853
+ * @since 1.5.0
854
+ */
855
+ function cptui_do_import_types_taxes() {
856
+
857
+ if ( ! empty( $_POST ) &&
858
+ ( ! empty( $_POST['cptui_post_import'] ) && isset( $_POST['cptui_post_import'] ) ) ||
859
+ ( ! empty( $_POST['cptui_tax_import'] ) && isset( $_POST['cptui_tax_import'] ) )
860
+ ) {
861
+ $success = cptui_import_types_taxes_settings( $_POST );
862
+ add_action( 'admin_notices', "cptui_{$success}_admin_notice" );
863
+ }
864
+ }
865
+ add_action( 'init', 'cptui_do_import_types_taxes', 8 );
inc/utility.php CHANGED
@@ -87,7 +87,7 @@ function disp_boolean( $bool_text ) {
87
  *
88
  * @internal
89
  *
90
- * @param string $original Original footer content.
91
  * @return string $value HTML for footer.
92
  */
93
  function cptui_footer( $original = '' ) {
@@ -128,7 +128,7 @@ function cptui_flush_rewrite_rules() {
128
  }
129
 
130
  /*
131
- * Wise men say that you should not do flush_rewrite_rules on init or admin_int. Due to the nature of our plugin
132
  * and how new post types or taxonomies can suddenly be introduced, we need to...potentially. For this,
133
  * we rely on a short lived transient. Only 5 minutes life span. If it exists, we do a soft flush before
134
  * deleting the transient to prevent subsequent flushes. The only times the transient gets created, is if
@@ -195,7 +195,7 @@ function cptui_get_taxonomy_slugs() {
195
  * @since 1.3.0
196
  *
197
  * @param string $path URL path.
198
- * @return string|void
199
  */
200
  function cptui_admin_url( $path ) {
201
  if ( is_multisite() && is_network_admin() ) {
@@ -210,7 +210,7 @@ function cptui_admin_url( $path ) {
210
  *
211
  * @since 1.3.0
212
  *
213
- * @param object|string $ui CPTUI Admin UI instance.
214
  * @return string
215
  */
216
  function cptui_get_post_form_action( $ui = '' ) {
@@ -238,7 +238,7 @@ function cptui_post_form_action( $ui ) {
238
  *
239
  * @since 1.3.0
240
  *
241
- * @return mixed|void
242
  */
243
  function cptui_get_post_type_data() {
244
  return apply_filters( 'cptui_get_post_type_data', get_option( 'cptui_post_types', array() ), get_current_blog_id() );
@@ -249,7 +249,7 @@ function cptui_get_post_type_data() {
249
  *
250
  * @since 1.3.0
251
  *
252
- * @return mixed|void
253
  */
254
  function cptui_get_taxonomy_data() {
255
  return apply_filters( 'cptui_get_taxonomy_data', get_option( 'cptui_taxonomies', array() ), get_current_blog_id() );
@@ -260,9 +260,9 @@ function cptui_get_taxonomy_data() {
260
  *
261
  * @since 1.3.0
262
  *
263
- * @param string $slug Post type slug to check.
264
- * @param array|string $data Post type data being utilized.
265
- * @return mixed|void
266
  */
267
  function cptui_get_post_type_exists( $slug = '', $data = array() ) {
268
 
@@ -310,7 +310,7 @@ function cptui_products_sidebar() {
310
  }
311
  printf(
312
  '<p><a href="%s">%s</a></p>',
313
- 'https://pluginize.com/product/custom-post-type-ui-extended/?utm_source=remove_ads&utm_medium=text&utm_campaign=cptui',
314
  esc_html__( 'Remove these ads?', 'custom-post-type-ui' )
315
  );
316
  }
@@ -393,12 +393,12 @@ function cptui_get_ads() {
393
  *
394
  * @internal
395
  *
396
- * @param array $ads Array of ads set so far.
397
  * @return array $ads Array of newly constructed ads.
398
  */
399
  function cptui_default_ads( $ads = array() ) {
400
  $ads[] = array(
401
- 'url' => 'https://pluginize.com/product/custom-post-type-ui-extended/?utm_source=sidebar-v3&utm_medium=banner&utm_campaign=cptui',
402
  'image' => plugin_dir_url( dirname( __FILE__ ) ) . 'images/wds_ads/cptuix-ad-3.png',
403
  'text' => 'Custom Post Type UI Extended product ad',
404
  );
@@ -426,9 +426,8 @@ add_filter( 'cptui_ads', 'cptui_default_ads' );
426
  *
427
  * @since 1.4.0
428
  *
429
- * @param string $message Message to use in admin notice.
430
- * @param bool $success Whether or not a success.
431
- *
432
  * @return mixed|void
433
  */
434
  function cptui_admin_notices_helper( $message = '', $success = true ) {
@@ -568,6 +567,28 @@ function cptui_delete_fail_admin_notice() {
568
  );
569
  }
570
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
571
  /**
572
  * Returns error message for if trying to register existing post type.
573
  *
@@ -635,3 +656,121 @@ function cptui_error_admin_notice() {
635
  false
636
  );
637
  }