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 | 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 +88 -0
- classes/class.cptui_debug_info.php +1 -1
- css/cptui.css +24 -0
- css/cptui.min.css +1 -1
- css/cptui.scss +26 -0
- custom-post-type-ui.php +34 -22
- images/cptui-icon-173x173.png +0 -0
- images/cptui-icon-256x256.png +0 -0
- inc/about.php +30 -16
- inc/listings.php +40 -12
- inc/post-types.php +40 -24
- inc/support.php +41 -24
- inc/taxonomies.php +16 -14
- inc/{import_export.php → tools.php} +158 -75
- inc/utility.php +154 -15
- js/cptui.js +19 -5
- js/cptui.min.js +1 -1
- readme.txt +54 -158
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.
|
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.
|
31 |
-
define( 'CPTUI_VERSION', '1.
|
32 |
define( 'CPTUI_WP_VERSION', get_bloginfo( 'version' ) );
|
33 |
|
34 |
/**
|
@@ -78,12 +78,14 @@ function cptui_make_activation_redirect() {
|
|
78 |
return;
|
79 |
}
|
80 |
|
81 |
-
|
|
|
|
|
82 |
|
83 |
// Redirect to CPTUI about page.
|
84 |
wp_safe_redirect(
|
85 |
add_query_arg(
|
86 |
-
|
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, __( '
|
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/
|
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 |
-
|
|
|
|
|
|
|
|
|
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'] =
|
527 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
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__(
|
59 |
<div class="changelog about-integrations">
|
60 |
<div class="cptui-feature feature-section col three-col">
|
61 |
<div>
|
62 |
-
<h2><?php esc_html_e( '
|
63 |
-
<p><?php esc_html_e( '
|
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
|
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
|
80 |
-
<p><?php
|
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
|
|
|
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=
|
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 |
-
|
145 |
-
|
146 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
</td>
|
148 |
<td>
|
149 |
<?php
|
@@ -160,7 +172,10 @@ function cptui_listings() {
|
|
160 |
);
|
161 |
}
|
162 |
} else {
|
163 |
-
|
|
|
|
|
|
|
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
|
|
|
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=
|
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 |
-
|
|
|
|
|
|
|
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'] =
|
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=
|
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">' .
|
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
|
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',
|
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 |
-
$
|
|
|
|
|
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
|
|
|
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/
|
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"
|
|
|
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/
|
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="
|
159 |
-
<div class="answer" id="
|
|
|
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="
|
169 |
-
<div class="answer" id="
|
|
|
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/
|
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="
|
182 |
-
<div class="answer" id="
|
183 |
-
|
184 |
-
|
|
|
|
|
|
|
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="
|
193 |
-
<div class="answer" id="
|
|
|
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="
|
202 |
-
<div class="answer" id="
|
|
|
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="
|
211 |
-
<div class="answer" id="
|
|
|
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="
|
223 |
-
<div class="answer" id="
|
224 |
-
'<a href="http://hookr.io/plugins/custom-post-type-ui/
|
225 |
</li>
|
226 |
<li>
|
227 |
-
<span tabindex="0" class="question" aria-controls="
|
228 |
-
<div class="answer" id="
|
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'] =
|
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=
|
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( $
|
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
|
4 |
*
|
5 |
* @package CPTUI
|
6 |
-
* @subpackage
|
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
|
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
|
28 |
|
29 |
-
if ( '
|
30 |
$classes = array( 'nav-tab' );
|
31 |
|
32 |
-
$tabs['page_title'] =
|
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', '
|
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
|
93 |
|
94 |
$tab = '';
|
95 |
if ( ! empty( $_GET ) ) {
|
96 |
-
if ( ! empty( $_GET['action'] ) && 'taxonomies'
|
97 |
$tab = 'taxonomies';
|
98 |
-
} elseif ( ! empty( $_GET['action'] ) && 'get_code'
|
99 |
$tab = 'get_code';
|
100 |
-
} elseif ( ! empty( $_GET['action'] ) && 'debuginfo'
|
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( '
|
122 |
|
123 |
// Create our tabs.
|
124 |
-
cptui_settings_tab_menu( $page = '
|
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( '
|
|
|
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 )
|
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 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
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 |
-
|
281 |
function <?php echo $callback; ?>() {
|
282 |
<?php // Space before this line reflects in textarea.
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
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 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
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
|
405 |
"show_in_menu" => <?php echo disp_boolean( $post_type['show_in_menu'] ); ?>,
|
406 |
-
|
|
|
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 |
-
|
415 |
-
|
416 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
417 |
<?php } ?>
|
418 |
-
|
|
|
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 |
-
|
|
|
|
|
564 |
}
|
565 |
|
566 |
-
return $
|
567 |
}
|
568 |
|
569 |
/**
|
570 |
-
* Content for the Post Types/Taxonomies
|
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
|
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
|
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( '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
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
|
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
|
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
|
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
|
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/
|
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/
|
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 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
*
|
88 |
* @internal
|
89 |
*
|
90 |
+
* @param string $original Original footer content. Optional. Default empty string.
|
91 |
* @return string $value HTML for footer.
|
92 |
*/
|
93 |
function cptui_footer( $original = '' ) {
|
128 |
}
|
129 |
|
130 |
/*
|
131 |
+
* Wise men say that you should not do flush_rewrite_rules on init or admin_init. 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 |
* @since 1.3.0
|
196 |
*
|
197 |
* @param string $path URL path.
|
198 |
+
* @return string
|
199 |
*/
|
200 |
function cptui_admin_url( $path ) {
|
201 |
if ( is_multisite() && is_network_admin() ) {
|
210 |
*
|
211 |
* @since 1.3.0
|
212 |
*
|
213 |
+
* @param object|string $ui CPTUI Admin UI instance. Optional. Default empty string.
|
214 |
* @return string
|
215 |
*/
|
216 |
function cptui_get_post_form_action( $ui = '' ) {
|
238 |
*
|
239 |
* @since 1.3.0
|
240 |
*
|
241 |
+
* @return mixed
|
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 |
*
|
250 |
* @since 1.3.0
|
251 |
*
|
252 |
+
* @return mixed
|
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 |
*
|
261 |
* @since 1.3.0
|
262 |
*
|
263 |
+
* @param string $slug Post type slug to check. Optional. Default empty string.
|
264 |
+
* @param array|string $data Post type data being utilized. Optional.
|
265 |
+
* @return mixed
|
266 |
*/
|
267 |
function cptui_get_post_type_exists( $slug = '', $data = array() ) {
|
268 |
|
310 |
}
|
311 |
printf(
|
312 |
'<p><a href="%s">%s</a></p>',
|
313 |
+
'https://pluginize.com/plugins/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 |
*
|
394 |
* @internal
|
395 |
*
|
396 |
+
* @param array $ads Array of ads set so far. Optional.
|
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/plugins/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 |
*
|
427 |
* @since 1.4.0
|
428 |
*
|
429 |
+
* @param string $message Message to use in admin notice. Optional. Default empty string.
|
430 |
+
* @param bool $success Whether or not a success. Optional. Default true.
|
|
|
431 |
* @return mixed|void
|
432 |
*/
|
433 |
function cptui_admin_notices_helper( $message = '', $success = true ) {
|
567 |
);
|
568 |
}
|
569 |
|
570 |
+
/**
|
571 |
+
* Success to import callback.
|
572 |
+
*
|
573 |
+
* @since 1.5.0
|
574 |
+
*/
|
575 |
+
function cptui_import_success_admin_notice() {
|
576 |
+
echo cptui_admin_notices_helper(
|
577 |
+
esc_html__( 'Successfully imported data.', 'custom-post-type-ui' )
|
578 |
+
);
|
579 |
+
}
|
580 |
+
|
581 |
+
/**
|
582 |
+
* Failure to import callback.
|
583 |
+
*
|
584 |
+
* @since 1.5.0
|
585 |
+
*/
|
586 |
+
function cptui_import_fail_admin_notice() {
|
587 |
+
echo cptui_admin_notices_helper(
|
588 |
+
esc_html__( 'Invalid data provided', 'custom-post-type-ui' )
|
589 |
+
);
|
590 |
+
}
|
591 |
+
|
592 |
/**
|
593 |
* Returns error message for if trying to register existing post type.
|
594 |
*
|
656 |
false
|
657 |
);
|
658 |
}
|
659 |
+
|
660 |
+
/**
|
661 |
+
* Mark site as not a new CPTUI install upon update to 1.5.0
|
662 |
+
*
|
663 |
+
* @since 1.5.0
|
664 |
+
*
|
665 |
+
* @param object $wp_upgrader WP_Upgrader instance.
|
666 |
+
* @param array $extras Extra information about performed upgrade.
|
667 |
+
*/
|
668 |
+
function cptui_not_new_install( $wp_upgrader, $extras ) {
|
669 |
+
// Was CPTUI updated?
|
670 |
+
if ( ! in_array( 'custom-post-type-ui/custom-post-type-ui.php', $extras['plugins'] ) ) {
|
671 |
+
return;
|
672 |
+
}
|
673 |
+
|
674 |
+
// If we are already known as not new, return.
|
675 |
+
if ( cptui_is_new_install() ) {
|
676 |
+
return;
|
677 |
+
}
|
678 |
+
|
679 |
+
// We need to mark ourselves as not new.
|
680 |
+
cptui_set_not_new_install();
|
681 |
+
}
|
682 |
+
add_action( 'upgrader_process_complete', 'cptui_not_new_install', 10, 2 );
|
683 |
+
|
684 |
+
/**
|
685 |
+
* Check whether or not we're on a new install.
|
686 |
+
*
|
687 |
+
* @since 1.5.0
|
688 |
+
*
|
689 |
+
* @return bool
|
690 |
+
*/
|
691 |
+
function cptui_is_new_install() {
|
692 |
+
$new_or_not = true;
|
693 |
+
$saved = get_option( 'cptui_new_install', '' );
|
694 |
+
|
695 |
+
if ( 'false' === $saved ) {
|
696 |
+
$new_or_not = false;
|
697 |
+
}
|
698 |
+
|
699 |
+
/**
|
700 |
+
* Filters the new install status.
|
701 |
+
*
|
702 |
+
* Offers third parties the ability to override if they choose to.
|
703 |
+
*
|
704 |
+
* @since 1.5.0
|
705 |
+
*
|
706 |
+
* @param bool $new_or_not Whether or not site is a new install.
|
707 |
+
*/
|
708 |
+
return (bool) apply_filters( 'cptui_is_new_install', $new_or_not );
|
709 |
+
}
|
710 |
+
|
711 |
+
/**
|
712 |
+
* Set our activation status to not new.
|
713 |
+
*
|
714 |
+
* @since 1.5.0
|
715 |
+
*/
|
716 |
+
function cptui_set_not_new_install() {
|
717 |
+
update_option( 'cptui_new_install', 'false' );
|
718 |
+
}
|
719 |
+
|
720 |
+
/**
|
721 |
+
* Returns saved values for single post type from CPTUI settings.
|
722 |
+
*
|
723 |
+
* @since 1.5.0
|
724 |
+
*
|
725 |
+
* @param string $post_type Post type to retrieve CPTUI object for.
|
726 |
+
* @return string
|
727 |
+
*/
|
728 |
+
function cptui_get_cptui_post_type_object( $post_type = '' ) {
|
729 |
+
$post_types = get_option( 'cptui_post_types' );
|
730 |
+
|
731 |
+
if ( array_key_exists( $post_type, $post_types ) ) {
|
732 |
+
return $post_types[ $post_type ];
|
733 |
+
}
|
734 |
+
return '';
|
735 |
+
}
|
736 |
+
|
737 |
+
/**
|
738 |
+
* Returns saved values for single taxonomy from CPTUI settings.
|
739 |
+
*
|
740 |
+
* @since 1.5.0
|
741 |
+
*
|
742 |
+
* @param string $taxonomy Taxonomy to retrieve CPTUI object for.
|
743 |
+
* @return string
|
744 |
+
*/
|
745 |
+
function cptui_get_cptui_taxonomy_object( $taxonomy = '' ) {
|
746 |
+
$taxonomies = get_option( 'cptui_taxonomies' );
|
747 |
+
|
748 |
+
if ( array_key_exists( $taxonomy, $taxonomies ) ) {
|
749 |
+
return $taxonomies[ $taxonomy ];
|
750 |
+
}
|
751 |
+
return '';
|
752 |
+
}
|
753 |
+
|
754 |
+
/**
|
755 |
+
* Checks if a requested post type has a custom CPTUI feature supported.
|
756 |
+
*
|
757 |
+
* @since 1.5.0
|
758 |
+
*
|
759 |
+
* @param string $post_type Post type slug.
|
760 |
+
* @param string $feature Feature to check for.
|
761 |
+
* @return bool
|
762 |
+
*/
|
763 |
+
function cptui_post_type_supports( $post_type, $feature ) {
|
764 |
+
|
765 |
+
$object = cptui_get_cptui_post_type_object( $post_type );
|
766 |
+
|
767 |
+
if ( ! empty( $object ) ) {
|
768 |
+
if ( array_key_exists( $feature, $object ) && ! empty( $object[ $feature ] ) ) {
|
769 |
+
return true;
|
770 |
+
}
|
771 |
+
|
772 |
+
return false;
|
773 |
+
}
|
774 |
+
|
775 |
+
return false;
|
776 |
+
}
|
js/cptui.js
CHANGED
@@ -49,12 +49,16 @@ postboxes.add_postbox_toggles(pagenow);
|
|
49 |
|
50 |
// Switch spaces for underscores on our slug fields.
|
51 |
$('#name').on('keyup',function(e){
|
|
|
52 |
var value = $(this).val();
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
|
|
|
|
|
|
58 |
|
59 |
//Displays a message if slug changes.
|
60 |
if(undefined != original_slug) {
|
@@ -95,6 +99,16 @@ postboxes.add_postbox_toggles(pagenow);
|
|
95 |
return s;
|
96 |
}
|
97 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
if ( undefined != wp.media ) {
|
99 |
var _custom_media = true,
|
100 |
_orig_send_attachment = wp.media.editor.send.attachment;
|
49 |
|
50 |
// Switch spaces for underscores on our slug fields.
|
51 |
$('#name').on('keyup',function(e){
|
52 |
+
|
53 |
var value = $(this).val();
|
54 |
+
if ( e.keyCode !== 9 ) {
|
55 |
+
value = value.replace(/ /g, "_");
|
56 |
+
value = value.toLowerCase();
|
57 |
+
value = replaceDiacritics(value);
|
58 |
+
value = transliterate(value);
|
59 |
+
value = replaceSpecialCharacters(value);
|
60 |
+
$(this).attr('value', value);
|
61 |
+
}
|
62 |
|
63 |
//Displays a message if slug changes.
|
64 |
if(undefined != original_slug) {
|
99 |
return s;
|
100 |
}
|
101 |
|
102 |
+
var cyrillic = {
|
103 |
+
"Ё": "YO", "Й": "I", "Ц": "TS", "У": "U", "К": "K", "Е": "E", "Н": "N", "Г": "G", "Ш": "SH", "Щ": "SCH", "З": "Z", "Х": "H", "Ъ": "'", "ё": "yo", "й": "i", "ц": "ts", "у": "u", "к": "k", "е": "e", "н": "n", "г": "g", "ш": "sh", "щ": "sch", "з": "z", "х": "h", "ъ": "'", "Ф": "F", "Ы": "I", "В": "V", "А": "a", "П": "P", "Р": "R", "О": "O", "Л": "L", "Д": "D", "Ж": "ZH", "Э": "E", "ф": "f", "ы": "i", "в": "v", "а": "a", "п": "p", "р": "r", "о": "o", "л": "l", "д": "d", "ж": "zh", "э": "e", "Я": "Ya", "Ч": "CH", "С": "S", "М": "M", "И": "I", "Т": "T", "Ь": "'", "Б": "B", "Ю": "YU", "я": "ya", "ч": "ch", "с": "s", "м": "m", "и": "i", "т": "t", "ь": "'", "б": "b", "ю": "yu"
|
104 |
+
};
|
105 |
+
|
106 |
+
function transliterate(word) {
|
107 |
+
return word.split('').map(function (char) {
|
108 |
+
return cyrillic[char] || char;
|
109 |
+
}).join("");
|
110 |
+
}
|
111 |
+
|
112 |
if ( undefined != wp.media ) {
|
113 |
var _custom_media = true,
|
114 |
_orig_send_attachment = wp.media.editor.send.attachment;
|
js/cptui.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
postboxes.add_postbox_toggles(pagenow),function($){function replaceDiacritics(s){for(var diacritics=[/[\300-\306]/g,/[\340-\346]/g,/[\310-\313]/g,/[\350-\353]/g,/[\314-\317]/g,/[\354-\357]/g,/[\322-\330]/g,/[\362-\370]/g,/[\331-\334]/g,/[\371-\374]/g,/[\321]/g,/[\361]/g,/[\307]/g,/[\347]/g],chars=["A","a","E","e","I","i","O","o","U","u","N","n","C","c"],i=0;i<diacritics.length;i++)s=s.replace(diacritics[i],chars[i]);return s}function replaceSpecialCharacters(s){return s=s.replace(/[^a-z0-9\s]/gi,"_")}function getParameterByName(name,url){url||(url=window.location.href),name=name.replace(/[\[\]]/g,"\\$&");var regex=new RegExp("[?&]"+name+"(=([^&#]*)|&|#|$)"),results=regex.exec(url);return results?results[2]?decodeURIComponent(results[2].replace(/\+/g," ")):"":null}if("edit"===getParameterByName("action"))var original_slug=$("#name").val()
|
1 |
+
postboxes.add_postbox_toggles(pagenow),function($){function replaceDiacritics(s){for(var diacritics=[/[\300-\306]/g,/[\340-\346]/g,/[\310-\313]/g,/[\350-\353]/g,/[\314-\317]/g,/[\354-\357]/g,/[\322-\330]/g,/[\362-\370]/g,/[\331-\334]/g,/[\371-\374]/g,/[\321]/g,/[\361]/g,/[\307]/g,/[\347]/g],chars=["A","a","E","e","I","i","O","o","U","u","N","n","C","c"],i=0;i<diacritics.length;i++)s=s.replace(diacritics[i],chars[i]);return s}function replaceSpecialCharacters(s){return s=s.replace(/[^a-z0-9\s]/gi,"_")}function transliterate(word){return word.split("").map(function(char){return cyrillic[char]||char}).join("")}function getParameterByName(name,url){url||(url=window.location.href),name=name.replace(/[\[\]]/g,"\\$&");var regex=new RegExp("[?&]"+name+"(=([^&#]*)|&|#|$)"),results=regex.exec(url);return results?results[2]?decodeURIComponent(results[2].replace(/\+/g," ")):"":null}if("edit"===getParameterByName("action"))var original_slug=$("#name").val();$("#post_type").on("change",function(){$("#cptui_select_post_type").submit()}),$("#taxonomy").on("change",function(){$("#cptui_select_taxonomy").submit()}),$("#cpt_submit_delete").on("click",function(){return!!confirm(cptui_type_data.confirm)}),$("#support .question").each(function(){var tis=$(this),state=!1,answer=tis.next("div").slideUp();tis.on("click keydown",function(e){"keydown"===e.type&&32!==e.keyCode&&13!==e.keyCode||(e.preventDefault(),state=!state,answer.slideToggle(state),tis.toggleClass("active",state),tis.attr("aria-expanded",state.toString()),tis.focus())})}),$("#name").on("keyup",function(e){var value=$(this).val();if(9!==e.keyCode&&(value=value.replace(/ /g,"_"),value=value.toLowerCase(),value=replaceDiacritics(value),value=transliterate(value),value=replaceSpecialCharacters(value),$(this).attr("value",value)),void 0!=original_slug){var $slugchanged=$("#slugchanged");value!=original_slug?$slugchanged.removeClass("hidemessage"):$slugchanged.addClass("hidemessage")}});var cyrillic={"Ё":"YO","Й":"I","Ц":"TS","У":"U","К":"K","Е":"E","Н":"N","Г":"G","Ш":"SH","Щ":"SCH","З":"Z","Х":"H","Ъ":"'","ё":"yo","й":"i","ц":"ts","у":"u","к":"k","е":"e","н":"n","г":"g","ш":"sh","щ":"sch","з":"z","х":"h","ъ":"'","Ф":"F","Ы":"I","В":"V","А":"a","П":"P","Р":"R","О":"O","Л":"L","Д":"D","Ж":"ZH","Э":"E","ф":"f","ы":"i","в":"v","а":"a","п":"p","р":"r","о":"o","л":"l","д":"d","ж":"zh","э":"e","Я":"Ya","Ч":"CH","С":"S","М":"M","И":"I","Т":"T","Ь":"'","Б":"B","Ю":"YU","я":"ya","ч":"ch","с":"s","м":"m","и":"i","т":"t","ь":"'","б":"b","ю":"yu"};if(void 0!=wp.media)var _custom_media=!0,_orig_send_attachment=wp.media.editor.send.attachment;$("#cptui_choose_icon").on("click",function(e){e.preventDefault();var button=$(this),id=jQuery("#menu_icon").attr("id");return _custom_media=!0,wp.media.editor.send.attachment=function(props,attachment){return _custom_media?void $("#"+id).val(attachment.url):_orig_send_attachment.apply(this,[props,attachment])},wp.media.editor.open(button),!1}),$("#togglelabels").on("click",function(e){e.preventDefault(),$("#labels_expand").toggleClass("toggledclosed")}),$("#togglesettings").on("click",function(e){e.preventDefault(),$("#settings_expand").toggleClass("toggledclosed")}),$("#labels_expand,#settings_expand").on("focus",function(e){$(this).hasClass("toggledclosed")&&$(this).toggleClass("toggledclosed")}),$("#labels_expand legend,#settings_expand legend").on("click",function(e){$(this).parent().toggleClass("toggledclosed")}),$(".cptui-help").on("click",function(e){e.preventDefault()}),$(".cptui-taxonomy-submit").on("click",function(e){0==$(".cptui-table :checkbox:checked").length&&(e.preventDefault(),alert(cptui_tax_data.no_associated_type))})}(jQuery);
|
readme.txt
CHANGED
@@ -1,21 +1,21 @@
|
|
1 |
=== Custom Post Type UI ===
|
2 |
Contributors: webdevstudios, pluginize, tw2113, vegasgeek, modemlooper, williamsba1
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3084056
|
4 |
-
Tags: custom post types, CPT, CMS, post, types, post type,
|
5 |
-
Requires at least: 4.
|
6 |
Tested up to: 4.7
|
7 |
-
Stable tag: 1.
|
8 |
License: GPLv2
|
9 |
|
10 |
-
Admin UI for creating custom post types and custom taxonomies
|
11 |
|
12 |
== Description ==
|
13 |
|
14 |
-
|
15 |
|
16 |
-
|
17 |
|
18 |
-
|
19 |
|
20 |
[Pluginize](https://pluginize.com/?utm_source=cptui&utm_medium=text&utm_campaign=wporg) was launched in 2016 by [WebDevStudios](https://webdevstudios.com/) to promote, support, and house all of their [WordPress products](https://pluginize.com/shop/?utm_source=cptui-&utm_medium=text&utm_campaign=wporg). Pluginize is not only [creating new products for WordPress all the time, like CPTUI Extended](https://pluginize.com/product/custom-post-type-ui-extended/?utm_source=cptui&utm_medium=text&utm_campaign=wporg), but also provides ongoing support and development for WordPress community favorites like [CMB2](https://wordpress.org/plugins/cmb2/) and more.
|
21 |
|
@@ -30,6 +30,23 @@ All official development on this plugin is on GitHub. New releases are still pub
|
|
30 |
|
31 |
== Changelog ==
|
32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
= 1.4.3 - 2016-10-17 =
|
34 |
* Fixed: issue with post types and taxonomies trying to be converted before registration. Prevented full success of process.
|
35 |
* Fixed: Prevent trying to convert taxonomy terms if no terms exist. Taxonomy will still be deleted from CPTUI list.
|
@@ -63,97 +80,25 @@ All official development on this plugin is on GitHub. New releases are still pub
|
|
63 |
* Updated: Updated about page.
|
64 |
* Updated: Further UI refinements to better match WordPress admin. Adapted styles found from metaboxes, including collapse/expand toggles.
|
65 |
|
66 |
-
= 1.3.5 - 2016-6-3 =
|
67 |
-
* Removed undefined index error for publicly_queryable in "Get Code" area. That parameter is targeted for 1.4.0 release.
|
68 |
-
|
69 |
-
= 1.3.4 - 2016-5-4 =
|
70 |
-
* Fixed: moved WDS-based services "ads" to within the plugin itself. Will not request remote resources.
|
71 |
-
* Fixed: Better output formatting if WDS/Pluginize "ads" failed to load images.
|
72 |
-
* Fixed: undefined variable error in cptui.js
|
73 |
-
* Added: Newsletter subscription form to stay uptodate with Custom Post Type UI & Custom Post Type UI Extended news.
|
74 |
-
* Added: Support page/FAQ info regarding Pluginize and recent sidebar developments.
|
75 |
-
|
76 |
-
= 1.3.3 - 2016-4-5 =
|
77 |
-
* Revert Changes for ajax/heartbeat API requests before post type registration. 3rd party or other plugins were breaking because post types were not registered.
|
78 |
-
|
79 |
-
= 1.3.2 - 2016-4-5 =
|
80 |
-
* Fixed: Logic issue with cptui js files loading where they weren't meant to.
|
81 |
-
* Fixed: Required markers missing on required post type fields.
|
82 |
-
* Fixed: Removed excess labels that are not used by WordPress core.
|
83 |
-
* Added: New contributors to readme file. Welcome John and Ryan.
|
84 |
-
* Updated: New screenshot from 1.3.0 release. Moved to assets folder so users will no longer download as part of CPTUI.
|
85 |
-
* Updated: Better prevention of running our code during ajax/heartbeat api requests.
|
86 |
-
|
87 |
-
= 1.3.1 - 2016-3-25 =
|
88 |
-
* Fixed: Logic issue for default values of `public` parameter for taxonomies added in 1.3.0.
|
89 |
-
|
90 |
-
= 1.3.0 - 2016-3-24 =
|
91 |
-
* Added: "CPTUI_VERSION" constant and deprecated "CPT_VERSION".
|
92 |
-
* Added: "Public" parameter for taxonomies
|
93 |
-
* Added: "View Post Types" and "View Taxonomies" tabs at top of add/edit screens.
|
94 |
-
* Added: Better prevention of potential duplicate slugs in new post types and taxonomies.
|
95 |
-
* Added: Current theme's textdomain as output in get code textareas.
|
96 |
-
* Added: Fill in singular and plural label fields if none provided. WordPress does not auto-fill these.
|
97 |
-
* Added: For developers: plenty of extra hooks all over for customization needs.
|
98 |
-
* Added: Javascript-based prevention of spaces and special characters for post type and taxonomy slugs.
|
99 |
-
* Added: Legend tag support to admin UI class.
|
100 |
-
* Added: Minified copies of our JavaScript and CSS. Define SCRIPT_DEBUG to true to use non-minified versions.
|
101 |
-
* Added: New post type and taxonomy labels provided by WordPress 4.3 and 4.4 releases.
|
102 |
-
* See: https://make.wordpress.org/core/2015/12/11/additional-labels-for-custom-post-types-and-custom-taxonomies/
|
103 |
-
* Added: Notes to post type and taxonomy edit screens about WordPress core's post types and taxonomies.
|
104 |
-
* Added: Taxonomy slug update ability with preserved term association.
|
105 |
-
* Added: Title, Editor, and Featured Image now checked by default for new post types.
|
106 |
-
* Added: "Show in Quick Edit" taxonomy parameter available in WP 4.2
|
107 |
-
* Added: Promo spots on add/edit screens for other products from WebDevStudios.
|
108 |
-
* Fixed: Need to visit permalinks page to flush rewrite rules after creating new post type or taxonomy.
|
109 |
-
* Fixed: Missing REST API based parameters in "Get Code" output.
|
110 |
-
* Updated: Increased accessibility coverage.
|
111 |
-
* Updated: Revised how tabs are added to pages so 3rd party developers can add their own tabs.
|
112 |
-
* Updated: Improved string consistency in our UI helper notes. Props @GaryJ
|
113 |
-
* Updated: Tested on WordPress 4.5
|
114 |
-
* Updated: Cleaned up admin footer area for social links.
|
115 |
-
* Updated: Moved all localization work to WordPress.org Translation packs
|
116 |
-
|
117 |
-
= 1.2.4 =
|
118 |
-
* Added: new CPTUI_VERSION constant to match naming of other current constants.
|
119 |
-
* Added: CPTUI_VERSION constant to cptui.css string for cache busting.
|
120 |
-
|
121 |
-
= 1.2.3 - 2016-01-31 =
|
122 |
-
* Fixed: copy/paste error with admin css. Props hinaloe.
|
123 |
-
|
124 |
-
= 1.2.2 - 2016-01-30 =
|
125 |
-
* Fixed: Missing admin menu icon for some browsers.
|
126 |
-
* Fixed: Undefined index notices for post type screen.
|
127 |
-
|
128 |
-
= 1.2.1 - 2016-01-17 =
|
129 |
-
* Fixed: Undefined index notices for custom taxonomies and new fields from 1.2.0
|
130 |
-
|
131 |
-
= 1.2.0 - 2016-01-15 =
|
132 |
-
* Added: Support for show_in_nav_menus parameter for post types.
|
133 |
-
* Added: Support for taxonomy descriptions.
|
134 |
-
* Added: Message on listings page if no post types or taxonomies are available.
|
135 |
-
* Added: Note regarding 'public' parameter not being true by default for WordPress but is for CPTUI.
|
136 |
-
* Added: Individual post type and taxonomy output for "Get Code" area.
|
137 |
-
* Added: Fallback values for post type/taxonomy select input and get code area if no plural label provided.
|
138 |
-
* Added: Support for custom query_var strings for post types.
|
139 |
-
* Added: Support for show_in_rest and rest_base for post types and taxonomies for the upcoming WordPress REST API.
|
140 |
-
* Added: Template hierarchy files to listings tables for user reference.
|
141 |
-
* Added: Form labels in more areas to help with accessibility and usability.
|
142 |
-
* Added: Fieldset method to Admin UI class for easily adding fieldset output.
|
143 |
-
* Added: Debugging tab for use with CPTUI support.
|
144 |
-
* Updated: Minimum version required. Now WordPress 4.2.
|
145 |
-
* Updated: Heading tags match accessibility changes in WordPress 4.3.
|
146 |
-
* Updated: Moved page title for some pages above tabs.
|
147 |
-
* Updated: Textdomain now matches WordPress.org repo slug.
|
148 |
-
* Updated: Added Visual Composer questions/answers to support section.
|
149 |
-
* Updated: Added question/answer regarding spaces in post type slugs
|
150 |
-
* Updated: Changed help icons to a Dashicon help icon.
|
151 |
-
* Fixed: Support for YARPP plugin.
|
152 |
-
* Fixed: Prevent potential issues with AJAX requests and our scripts/styles
|
153 |
-
|
154 |
== Upgrade Notice ==
|
155 |
|
156 |
-
= 1.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
157 |
* Fixed: issue with post types and taxonomies trying to be converted before registration. Prevented full success of process.
|
158 |
* Fixed: Prevent trying to convert taxonomy terms if no terms exist. Taxonomy will still be deleted from CPTUI list.
|
159 |
* Fixed: Prevent trying to redirect on activation if being network-activated.
|
@@ -186,77 +131,28 @@ All official development on this plugin is on GitHub. New releases are still pub
|
|
186 |
* Updated: Updated about page.
|
187 |
* Updated: Further UI refinements to better match WordPress admin. Adapted styles found from metaboxes, including collapse/expand toggles.
|
188 |
|
189 |
-
|
190 |
-
* Removed undefined index error for publicly_queryable in "Get Code" area. That parameter is targeted for 1.4.0 release.
|
191 |
-
|
192 |
-
= 1.3.4 - 2016-5-4 =
|
193 |
-
* Fixed: moved WDS-based services "ads" to within the plugin itself. Will not request remote resources.
|
194 |
-
* Fixed: Better output formatting if WDS/Pluginize "ads" failed to load images.
|
195 |
-
* Fixed: undefined variable error in cptui.js
|
196 |
-
* Added: Newsletter subscription form to stay uptodate with Custom Post Type UI & Custom Post Type UI Extended news.
|
197 |
-
* Added: Support page/FAQ info regarding Pluginize and recent sidebar developments.
|
198 |
-
|
199 |
-
= 1.3.3 - 2016-4-5 =
|
200 |
-
* Revert Changes for ajax/heartbeat API requests before post type registration. 3rd party or other plugins were breaking because post types were not registered.
|
201 |
-
|
202 |
-
= 1.3.2 - 2016-4-5 =
|
203 |
-
* Fixed: Logic issue with cptui js files loading where they weren't meant to.
|
204 |
-
* Fixed: Required markers missing on required post type fields.
|
205 |
-
* Fixed: Removed excess labels that are not used by WordPress core.
|
206 |
-
* Added: New contributors to readme file. Welcome John and Ryan.
|
207 |
-
* Updated: New screenshot from 1.3.0 release. Moved to assets folder so users will no longer download as part of CPTUI.
|
208 |
-
* Updated: Better prevention of running our code during ajax/heartbeat api requests.
|
209 |
-
|
210 |
-
= 1.3.1 - 2016-3-25 =
|
211 |
-
* Fixed: Logic issue for default values of `public` parameter for taxonomies added in 1.3.0.
|
212 |
|
213 |
-
=
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
* Added: Current theme's textdomain as output in get code textareas.
|
219 |
-
* Added: Fill in singular and plural label fields if none provided. WordPress does not auto-fill these.
|
220 |
-
* Added: For developers: plenty of extra hooks all over for customization needs.
|
221 |
-
* Added: Javascript-based prevention of spaces and special characters for post type and taxonomy slugs.
|
222 |
-
* Added: Legend tag support to admin UI class.
|
223 |
-
* Added: Minified copies of our JavaScript and CSS. Define SCRIPT_DEBUG to true to use non-minified versions.
|
224 |
-
* Added: New post type and taxonomy labels provided by WordPress 4.3 and 4.4 releases.
|
225 |
-
* See: https://make.wordpress.org/core/2015/12/11/additional-labels-for-custom-post-types-and-custom-taxonomies/
|
226 |
-
* Added: Notes to post type and taxonomy edit screens about WordPress core's post types and taxonomies.
|
227 |
-
* Added: Taxonomy slug update ability with preserved term association.
|
228 |
-
* Added: Title, Editor, and Featured Image now checked by default for new post types.
|
229 |
-
* Added: "Show in Quick Edit" taxonomy parameter available in WP 4.2
|
230 |
-
* Added: Promo spots on add/edit screens for other products from WebDevStudios.
|
231 |
-
* Fixed: Need to visit permalinks page to flush rewrite rules after creating new post type or taxonomy.
|
232 |
-
* Fixed: Missing REST API based parameters in "Get Code" output.
|
233 |
-
* Updated: Increased accessibility coverage.
|
234 |
-
* Updated: Revised how tabs are added to pages so 3rd party developers can add their own tabs.
|
235 |
-
* Updated: Improved string consistency in our UI helper notes. Props @GaryJ
|
236 |
-
* Updated: Tested on WordPress 4.5
|
237 |
-
* Updated: Cleaned up admin footer area for social links.
|
238 |
-
* Updated: Moved all localization work to WordPress.org Translation packs
|
239 |
|
240 |
-
|
|
|
|
|
|
|
|
|
241 |
|
242 |
= Manual =
|
243 |
-
1. Upload the Custom Post Type UI folder to the plugins directory in your WordPress installation
|
244 |
2. Activate the plugin.
|
245 |
3. Navigate to the "CPTUI" Menu.
|
246 |
|
247 |
-
|
248 |
-
1. Visit the Add New plugin screen and search for "custom post type ui"
|
249 |
-
2. Click the "Install Now" button.
|
250 |
-
3. Activate the plugin.
|
251 |
-
4. Navigate to the "CPTUI" Menu.
|
252 |
-
|
253 |
-
That's it! Now you can easily start creating custom post types and taxonomies in WordPress
|
254 |
|
255 |
== Frequently Asked Questions ==
|
256 |
|
257 |
User documentation: http://docs.pluginize.com/collection/1-custom-post-type-ui
|
258 |
Code/API documentation: http://codex.pluginize.com/cptui/
|
259 |
-
|
260 |
-
== Other Notes ==
|
261 |
-
|
262 |
-
Import/Export functionality amended from original contribution by [Ben Allfree](http://wordpress.org/support/profile/benallfree).
|
1 |
=== Custom Post Type UI ===
|
2 |
Contributors: webdevstudios, pluginize, tw2113, vegasgeek, modemlooper, williamsba1
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3084056
|
4 |
+
Tags: custom post types, CPT, CMS, post, types, post type, taxonomy, tax, custom, content types, post types
|
5 |
+
Requires at least: 4.6
|
6 |
Tested up to: 4.7
|
7 |
+
Stable tag: 1.5.0
|
8 |
License: GPLv2
|
9 |
|
10 |
+
Admin UI for creating custom post types and custom taxonomies for WordPress
|
11 |
|
12 |
== Description ==
|
13 |
|
14 |
+
Custom Post Type UI provides an easy to use interface for registering and managing custom post types and taxonomies for your website.
|
15 |
|
16 |
+
CPTUI alone does not handle aspects related to the display of post type or taxonomy content. Its goal is simply the registration of both. For help with content display, please check out [Custom Post Type UI Extended](https://pluginize.com/product/custom-post-type-ui-extended/?utm_source=cptui-desription&utm_medium=text&utm_campaign=wporg). CPTUI-Extended provides tools intended to help display content from all registered types in your site.
|
17 |
|
18 |
+
Official development of Custom Post Type UI is on GitHub, with official stable releases published on WordPress.org. The GitHub repo can be found at [https://github.com/WebDevStudios/custom-post-type-ui](https://github.com/WebDevStudios/custom-post-type-ui). Please use the Support tab for potential bugs, issues, or enhancement ideas.
|
19 |
|
20 |
[Pluginize](https://pluginize.com/?utm_source=cptui&utm_medium=text&utm_campaign=wporg) was launched in 2016 by [WebDevStudios](https://webdevstudios.com/) to promote, support, and house all of their [WordPress products](https://pluginize.com/shop/?utm_source=cptui-&utm_medium=text&utm_campaign=wporg). Pluginize is not only [creating new products for WordPress all the time, like CPTUI Extended](https://pluginize.com/product/custom-post-type-ui-extended/?utm_source=cptui&utm_medium=text&utm_campaign=wporg), but also provides ongoing support and development for WordPress community favorites like [CMB2](https://wordpress.org/plugins/cmb2/) and more.
|
21 |
|
30 |
|
31 |
== Changelog ==
|
32 |
|
33 |
+
= 1.5.0 - 2017-1-10 =
|
34 |
+
* Added: Helper functions to grab individual post types or taxonomies from CPTUI options, function to check for support for custom saved values.
|
35 |
+
* Added: Helper functions to mark and check if a new CPTUI install.
|
36 |
+
* Added: FAQ clarifying why post type/taxonomy slugs are forced to underscores. We mean well, I assure you.
|
37 |
+
* Added: Conversion from Cyrillic characters to latin equivalents.
|
38 |
+
* Fixed: Parameter handling for get_terms() to match WordPress 4.5.
|
39 |
+
* Fixed: Added "action" as a reserved taxonomy name.
|
40 |
+
* Fixed: PHP Notices for rewrite array index, present since version 1.0.6
|
41 |
+
* Fixed: Prevent triggering post type/taxonomy slug convert when navigating screen via tab key.
|
42 |
+
* Fixed: Provide empty quote indicator in Registered Post Types and Taxonomies screen for empty values.
|
43 |
+
* Fixed: Post types and taxonomies no longer need extra page refresh to be registered after an import.
|
44 |
+
* Updated: Further evolved Registered Post Types and Taxonomies screen to better match list table styles.
|
45 |
+
* Updated: Bumped minimum required WordPress version to 4.6.
|
46 |
+
* Updated: Clarified what checking a checkbox does in regards to "Supports" area of post type settings.
|
47 |
+
* Updated: Changed appropriate help/support links to docs.pluginize.com.
|
48 |
+
* Updated: Added filter to tab collection for the tools section. You can now add your own tabs.
|
49 |
+
|
50 |
= 1.4.3 - 2016-10-17 =
|
51 |
* Fixed: issue with post types and taxonomies trying to be converted before registration. Prevented full success of process.
|
52 |
* Fixed: Prevent trying to convert taxonomy terms if no terms exist. Taxonomy will still be deleted from CPTUI list.
|
80 |
* Updated: Updated about page.
|
81 |
* Updated: Further UI refinements to better match WordPress admin. Adapted styles found from metaboxes, including collapse/expand toggles.
|
82 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
== Upgrade Notice ==
|
84 |
|
85 |
+
= 1.5.0 - 2017-1-10 =
|
86 |
+
* Added: Helper functions to grab individual post types or taxonomies from CPTUI options, function to check for support for custom saved values.
|
87 |
+
* Added: Helper functions to mark and check if a new CPTUI install.
|
88 |
+
* Added: FAQ clarifying why post type/taxonomy slugs are forced to underscores. We mean well, I assure you.
|
89 |
+
* Fixed: Parameter handling for get_terms() to match WordPress 4.5.
|
90 |
+
* Fixed: Added "action" as a reserved taxonomy name.
|
91 |
+
* Fixed: PHP Notices for rewrite array index, present since version 1.0.6
|
92 |
+
* Fixed: Prevent triggering post type/taxonomy slug convert when navigating screen via tab key.
|
93 |
+
* Fixed: Provide empty quote indicator in Registered Post Types and Taxonomies screen for empty values.
|
94 |
+
* Fixed: Post types and taxonomies no longer need extra page refresh to be registered after an import.
|
95 |
+
* Updated: Further evolved Registered Post Types and Taxonomies screen to better match list table styles.
|
96 |
+
* Updated: Bumped minimum required WordPress version to 4.6.
|
97 |
+
* Updated: Clarified what checking a checkbox does in regards to "Supports" area of post type settings.
|
98 |
+
* Updated: Changed appropriate help/support links to docs.pluginize.com.
|
99 |
+
* Updated: Added filter to tab collection for the tools section. You can now add your own tabs.
|
100 |
+
|
101 |
+
= 1.4.3 - 2016-10-17 =
|
102 |
* Fixed: issue with post types and taxonomies trying to be converted before registration. Prevented full success of process.
|
103 |
* Fixed: Prevent trying to convert taxonomy terms if no terms exist. Taxonomy will still be deleted from CPTUI list.
|
104 |
* Fixed: Prevent trying to redirect on activation if being network-activated.
|
131 |
* Updated: Updated about page.
|
132 |
* Updated: Further UI refinements to better match WordPress admin. Adapted styles found from metaboxes, including collapse/expand toggles.
|
133 |
|
134 |
+
== Installation ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
|
136 |
+
= Admin Installer via search =
|
137 |
+
1. Visit the Add New plugin screen and search for "custom post type ui".
|
138 |
+
2. Click the "Install Now" button.
|
139 |
+
3. Activate the plugin.
|
140 |
+
4. Navigate to the "CPTUI" Menu.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
141 |
|
142 |
+
= Admin Installer via zip =
|
143 |
+
1. Visit the Add New plugin screen and click the "Upload Plugin" button.
|
144 |
+
2. Click the "Browse..." button and select zip file from your computer.
|
145 |
+
3. Click "Install Now" button.
|
146 |
+
4. Once done uploading, activate Custom Post Type UI.
|
147 |
|
148 |
= Manual =
|
149 |
+
1. Upload the Custom Post Type UI folder to the plugins directory in your WordPress installation.
|
150 |
2. Activate the plugin.
|
151 |
3. Navigate to the "CPTUI" Menu.
|
152 |
|
153 |
+
That's it! Now you can easily start creating custom post types and taxonomies in WordPress.
|
|
|
|
|
|
|
|
|
|
|
|
|
154 |
|
155 |
== Frequently Asked Questions ==
|
156 |
|
157 |
User documentation: http://docs.pluginize.com/collection/1-custom-post-type-ui
|
158 |
Code/API documentation: http://codex.pluginize.com/cptui/
|
|
|
|
|
|
|
|