From deb63f4e2825c1f260a1f9e4058b79b81afa5c64 Mon Sep 17 00:00:00 2001
From: Michael Beckwith
Date: Tue, 30 Mar 2021 21:21:39 -0500
Subject: [PATCH] merge in version 1.9.0
---
CHANGELOG.md | 51 ++++++-
composer.json | 80 +++++-----
css/cptui.css | 46 +-----
css/cptui.min.css | 2 +-
css/cptui.scss | 50 +-----
custom-post-type-ui.php | 10 +-
external/wpgraphql.php | 329 ++++++++++++++++++++++++++++++++++++++++
inc/about.php | 13 +-
inc/listings.php | 2 +-
inc/post-types.php | 1 -
inc/taxonomies.php | 2 +-
inc/utility.php | 6 +-
readme.txt | 82 ++--------
13 files changed, 467 insertions(+), 207 deletions(-)
create mode 100644 external/wpgraphql.php
diff --git a/CHANGELOG.md b/CHANGELOG.md
index dc42ba6e..74ef6176 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,49 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Not documented.
+## [1.7.5] - 2020-08-11
+### Updated
+- Addressed UI issues with WordPress 5.5.0
+- Updated: Moved required minimum WordPress version to 5.5.0
+
+## [1.7.4] - 2020-03-17
+### Added
+- Nonce admin verification for import functionality.
+- Added: Extra escaping of markup and output for "Get Code" areas.
+
+## [1.7.3] - 2020-02-05
+### Updated
+- styles and appearance to better match WordPress core.
+- Updated: Change newsletter service integration. Hey, sign up for our newsletter! Props @Oceas
+
+## [1.7.2] - 2020-01-08
+### Fixed
+- Duplicate entries for "delete_with_user" in get code.
+- Fixed: Delete button for post types and taxonomies at bottom of page did not trigger dialog prompt.
+
+## [1.7.1] - 2019-11-06
+### Fixed
+- Random-ish redirects to the "Add new" tab for post types or taxonomies
+- Fixed: JavaScript error when trying to delete a taxonomy.
+
+## [1.7.0] - 2019-11-06
+### Added
+- Actually added this time: Delete with user support for post types. Managed to miss the code with 1.6.0 which was a
+ long time ago.
+- Added: Ability to disable registration of post types or taxonomies, via code filter, without deleting them completely
+ from settings.
+- Added: New post type labels introduced in WordPress 5.0.0.
+- Added: Link to Dashicon documentation for when editing menu icon. Props @juliekuehl
+- Added: Ability to automatically fill in additional labels based on chosen plural and singular label text.
+### Updated
+-Updated: Added post type templates documentation to help section.
+-Updated: Redirect user to the "add" tab if deleting the last post type or taxonomy created.
+-Updated: Touched up tab markup to match semantic improvements provided by WordPress 5.2.0.
+### Fixed
+- Fixed: potential duplicate output of "parent_item_colon" with "Get Code" output.
+### Misc
+- Misc: Added code of conduct file to github repo. Props GaryJones.
+
## [1.6.2] - 2019-05-20
### Added
- "themes" is now a reserved post type slug due to conflicts with WordPress internally.
@@ -437,7 +480,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
[Gary Jones]: https://github.com/GaryJones
-[Unreleased]: https://github.com/WebDevStudios/custom-post-type-ui/compare/1.6.2...HEAD
+[Unreleased]: https://github.com/WebDevStudios/custom-post-type-ui/compare/1.7.5...HEAD
+[1.7.5]: https://github.com/WebDevStudios/custom-post-type-ui/compare/1.7.4...1.7.5
+[1.7.4]: https://github.com/WebDevStudios/custom-post-type-ui/compare/1.7.3...1.7.4
+[1.7.3]: https://github.com/WebDevStudios/custom-post-type-ui/compare/1.7.2...1.7.3
+[1.7.2]: https://github.com/WebDevStudios/custom-post-type-ui/compare/1.7.1...1.7.2
+[1.7.1]: https://github.com/WebDevStudios/custom-post-type-ui/compare/1.7.0...1.7.1
+[1.7.0]: https://github.com/WebDevStudios/custom-post-type-ui/compare/1.6.2...1.7.0
[1.6.2]: https://github.com/WebDevStudios/custom-post-type-ui/compare/1.6.1...1.6.2
[1.6.1]: https://github.com/WebDevStudios/custom-post-type-ui/compare/1.6.0...1.6.1
[1.6.0]: https://github.com/WebDevStudios/custom-post-type-ui/compare/1.5.8...1.6.0
diff --git a/composer.json b/composer.json
index 69837b13..017e8056 100644
--- a/composer.json
+++ b/composer.json
@@ -1,40 +1,40 @@
-{
- "name": "webdevstudios/custom-post-type-ui",
- "description": "Custom Post Type UI Plugin for Wordpress found at https://wordpress.org/plugins/custom-post-type-ui/ ",
- "homepage": "https://github.com/WebDevStudios/custom-post-type-ui",
- "type": "wordpress-plugin",
- "keywords": ["custom post types", "taxonomies", "CPT", "CMS", "post type", "custom-post-type", "taxonomy", "tax"],
- "license": "GPL-2.0+",
- "authors": [
- {
- "name": "WebDevStudios",
- "email": "contact@webdevstudios.com",
- "homepage": "https://github.com/WebDevStudios/custom-post-type-ui"
- }
- ],
- "support": {
- "issues": "https://github.com/WebDevStudios/custom-post-type-ui",
- "forum": "https://wordpress.org/support/plugin/custom-post-type-ui",
- "docs": "http://docs.pluginize.com/"
- },
- "config": {
- "sort-order": true
- },
- "minimum-stability": "dev",
- "prefer-stable": true,
- "require": {
- "php": "^5.2|^7",
- "composer/installers": "~1.0",
- "roave/security-advisories": "dev-master"
- },
- "require-dev": {
- "php": "^5.6|^7.0",
- "brain/monkey": "^2.0",
- "dealerdirect/phpcodesniffer-composer-installer": "^0.4.3",
- "johnbillion/php-docs-standards": "~1.0",
- "phpunit/phpunit": "^5.7",
- "sirbrillig/phpcs-variable-analysis": "^2.0",
- "wimg/php-compatibility": "^8.0.1",
- "wp-coding-standards/wpcs": "^0.14.0"
- }
-}
+{
+ "name": "webdevstudios/custom-post-type-ui",
+ "description": "Custom Post Type UI Plugin for Wordpress found at https://wordpress.org/plugins/custom-post-type-ui/ ",
+ "homepage": "https://github.com/WebDevStudios/custom-post-type-ui",
+ "type": "wordpress-plugin",
+ "keywords": ["custom post types", "taxonomies", "CPT", "CMS", "post type", "custom-post-type", "taxonomy", "tax"],
+ "license": "GPL-2.0+",
+ "authors": [
+ {
+ "name": "WebDevStudios",
+ "email": "contact@webdevstudios.com",
+ "homepage": "https://github.com/WebDevStudios/custom-post-type-ui"
+ }
+ ],
+ "support": {
+ "issues": "https://github.com/WebDevStudios/custom-post-type-ui",
+ "forum": "https://wordpress.org/support/plugin/custom-post-type-ui",
+ "docs": "http://docs.pluginize.com/"
+ },
+ "config": {
+ "sort-order": true
+ },
+ "minimum-stability": "dev",
+ "prefer-stable": true,
+ "require": {
+ "php": "^5.6|^7",
+ "composer/installers": "~1.0",
+ "roave/security-advisories": "dev-master"
+ },
+ "require-dev": {
+ "php": "^5.6|^7.0",
+ "brain/monkey": "^2.0",
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.4.3",
+ "johnbillion/php-docs-standards": "~1.0",
+ "phpunit/phpunit": "^5.7",
+ "sirbrillig/phpcs-variable-analysis": "^2.0",
+ "wimg/php-compatibility": "^8.0.1",
+ "wp-coding-standards/wpcs": "^2.3.0"
+ }
+}
diff --git a/css/cptui.css b/css/cptui.css
index e7efed55..b025b440 100644
--- a/css/cptui.css
+++ b/css/cptui.css
@@ -32,21 +32,12 @@
color: red;
}
-.cptui-table #excerpt {
- display: inline-block;
- height: 16px;
- margin: 12px 4px 12px 0;
- width: auto;
-}
-
.cptui-table td.outer {
vertical-align: top;
width: 50%;
}
-.cptui-table input[type="text"],
-.cptui-new .cptui-table textarea,
-.cptui-edit .cptui-table textarea {
+.cptui-table input[type="text"] {
width: 75%;
}
@@ -72,10 +63,6 @@
display: none;
}
-.cpt-ui_page_cptui_tools .cptui-table .outer p {
- padding: 0 4px;
-}
-
.cptui-support #support .question {
font-size: 18px;
font-weight: bold;
@@ -185,19 +172,6 @@
-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;
@@ -222,6 +196,10 @@
color: #cccccc;
}
+.email-octopus-form-row-hp {
+ visibility: hidden;
+}
+
.cptui-intro-devblock {
display: -ms-flexbox;
display: flex;
@@ -229,14 +207,6 @@
flex-direction: row;
}
-#togglelabels {
- display: none;
-}
-
-.js #togglelabels {
- display: inline-block;
-}
-
.cptui-help {
color: #424242;
margin-left: 4px;
@@ -270,12 +240,6 @@ fieldset .cptui-help {
width: 20px;
}
-#toplevel_page_cptui_main_menu img {
- height: 20px;
- margin-top: -2px;
- width: 20px;
-}
-
.visuallyhidden {
position: absolute;
left: -10000px;
diff --git a/css/cptui.min.css b/css/cptui.min.css
index ecacbfb1..f2a4a48f 100644
--- a/css/cptui.min.css
+++ b/css/cptui.min.css
@@ -1 +1 @@
-.posttypesui,.taxonomiesui{width:calc(100% - 300px)}.posttypesui .cptui-section:first-child,.taxonomiesui .cptui-section:first-child{margin-top:30px}.posttypesui .postbox-container,.taxonomiesui .postbox-container{width:100%}.posttypesui .postbox .toggle-indicator:before,.taxonomiesui .postbox .toggle-indicator:before{content:"\f142";display:inline-block;font:normal 20px/1 dashicons;speak:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-decoration:none!important}.posttypesui .postbox.closed .handlediv .toggle-indicator:before,.taxonomiesui .postbox.closed .handlediv .toggle-indicator:before{content:"\f140"}.posttypesui .postbox .hndle,.taxonomiesui .postbox .hndle{cursor:pointer}.posttypesui .required,.taxonomiesui .required{color:red}.cptui-table #excerpt{display:inline-block;height:16px;margin:12px 4px 12px 0;width:auto}.cptui-table td.outer{vertical-align:top;width:50%}.cptui-edit .cptui-table textarea,.cptui-new .cptui-table textarea,.cptui-table input[type=text]{width:75%}.cptui-table .question:hover{cursor:pointer}.cptui-table th p{font-weight:400;font-size:12px}.cptui-table .cptui-slug-details{margin-top:15px}.cptui-table #slugchanged,.cptui-table #slugexists{color:red;font-weight:700}.cptui-table #slugchanged.hidemessage,.cptui-table #slugexists.hidemessage{display:none}.cpt-ui_page_cptui_tools .cptui-table .outer p{padding:0 4px}.cptui-support #support .question{font-size:18px;font-weight:700}.cptui-support #support .question:before{content:"\f139";display:inline-block;font:normal 25px/1 dashicons;margin-left:-25px;position:absolute;-webkit-font-smoothing:antialiased}.cptui-support #support .question.active:before{content:"\f140"}.cptui-support #support .answer{margin:10px 0 0 20px}.cptui-support #support ol li{list-style:none}.cptui-support #support li{position:relative}.cptui-field-description{font-style:italic}#cptui_select_post_type,#cptui_select_taxonomy{margin-top:15px}.cptui_post_import,.cptui_tax_import{height:200px;margin-bottom:10px;resize:vertical;width:100%}.cptui_post_type_get_code,.cptui_tax_get_code{height:300px;resize:vertical}.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;margin-right:0;max-width:calc(100% - 173px)}.email-octopus-form-row input:-ms-input-placeholder{color:#ccc}.email-octopus-form-row input::placeholder{color:#ccc}.cptui-intro-devblock{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row}#togglelabels{display:none}.js #togglelabels{display:inline-block}.cptui-help{color:#424242;margin-left:4px;opacity:.5;text-decoration:none;width:16px}fieldset .cptui-help{position:relative;top:4px}.cptui-help:hover{color:#0074a2;opacity:1}.cptui-help:focus{box-shadow:none}#menu_icon_preview{float:right;padding-left:8px}#menu_icon_preview img{display:block;height:20px;width:20px}#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-spacer{display:block;margin-top:25px}.email-octopus-form-wrapper{background:#fff;margin-bottom:10px;padding:20px}.email-octopus-form-wrapper label{margin-bottom:10px}.wdsoctosignup h2{text-align:left}.wdspromos{float:right;margin-left:20px;margin-top:10px;width:275px}.wdspromos-about{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-wrap:nowrap;flex-wrap:nowrap;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-line-pack:stretch;align-content:stretch;-ms-flex-align:start;align-items:flex-start;margin:20px 0}.wdspromos-about a:first-child,.wdspromos-about a:nth-child(2),.wdspromos-about a:nth-child(3){-ms-flex-order:0;order:0;-ms-flex:0 1 auto;flex:0 1 auto;-ms-flex-item-align:auto;-ms-grid-row-align:auto;align-self:auto}.wdspromos-about p{padding:0 5px}.wdspromos-about p:first-child{padding-left:0}.wdspromos-about p:nth-child(4){padding-right:0}.no-js #cptui_choose_icon{display:none}.cptui-listings th{font-weight:700}.cptui-listings .post-type-listing th{width:16.66667%}.cptui-listings .taxonomy-listing th{width:20%}#poststuff{min-width:463px}@media screen and (min-width:769px){.cptui-badge{margin-top:-42px;height:173px;width:173px;color:#fafafa;font-weight:700;font-size:14px;text-align:center;margin-bottom:10px;background:url(../images/cptui-icon-173x173.png) no-repeat}}@media screen and (max-width:768px){.cptui-table #description{width:100%}.wdspromos-about{-ms-flex-wrap:wrap;flex-wrap:wrap}.wdspromos-about p{margin:5px auto}.wdspromos-about p:first-child{padding-left:5px}.wdspromos-about p:nth-child(4){padding-right:5px}#cptui_debug_info_email,.cptui-table td.outer{width:100%}}
\ No newline at end of file
+.posttypesui,.taxonomiesui{width:calc(100% - 300px)}.posttypesui .cptui-section:first-child,.taxonomiesui .cptui-section:first-child{margin-top:30px}.posttypesui .postbox-container,.taxonomiesui .postbox-container{width:100%}.posttypesui .postbox .toggle-indicator:before,.taxonomiesui .postbox .toggle-indicator:before{content:"\f142";display:inline-block;font:normal 20px/1 dashicons;speak:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-decoration:none!important}.posttypesui .postbox.closed .handlediv .toggle-indicator:before,.taxonomiesui .postbox.closed .handlediv .toggle-indicator:before{content:"\f140"}.posttypesui .postbox .hndle,.taxonomiesui .postbox .hndle{cursor:pointer}.posttypesui .required,.taxonomiesui .required{color:red}.cptui-table td.outer{vertical-align:top;width:50%}.cptui-table input[type=text]{width:75%}.cptui-table .question:hover{cursor:pointer}.cptui-table th p{font-weight:400;font-size:12px}.cptui-table .cptui-slug-details{margin-top:15px}.cptui-table #slugchanged,.cptui-table #slugexists{color:red;font-weight:700}.cptui-table #slugchanged.hidemessage,.cptui-table #slugexists.hidemessage{display:none}.cptui-support #support .question{font-size:18px;font-weight:700}.cptui-support #support .question:before{content:"\f139";display:inline-block;font:normal 25px/1 dashicons;margin-left:-25px;position:absolute;-webkit-font-smoothing:antialiased}.cptui-support #support .question.active:before{content:"\f140"}.cptui-support #support .answer{margin:10px 0 0 20px}.cptui-support #support ol li{list-style:none}.cptui-support #support li{position:relative}.cptui-field-description{font-style:italic}#cptui_select_post_type,#cptui_select_taxonomy{margin-top:15px}.cptui_post_import,.cptui_tax_import{height:200px;margin-bottom:10px;resize:vertical;width:100%}.cptui_post_type_get_code,.cptui_tax_get_code{height:300px;resize:vertical}.about-wrap .cptui-feature{overflow:visible!important;*zoom:1}.about-wrap .cptui-feature:after,.about-wrap .cptui-feature:before{content:" ";display:table}.about-wrap .cptui-feature:after{clear:both}.about-wrap h3+.cptui-feature{margin-top:0}.about-wrap .changelog h2{text-align:center}.about-wrap .feature-rest div{width:50%!important;padding-right:100px;box-sizing:border-box;margin:0!important}.about-wrap .feature-rest div.last-feature{padding-left:100px;padding-right:0}.about-wrap .feature-rest div.icon{width:0!important;padding:0;margin:0}.about-wrap .feature-rest div.icon:before{font-weight:400;width:100%;font-size:170px;line-height:125px;color:#9c5d90;display:inline-block;position:relative;text-align:center;speak:none;margin:0 0 0 -100px;content:"\e01d";-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.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;margin-right:0;max-width:calc(100% - 173px)}.email-octopus-form-row input:-ms-input-placeholder{color:#ccc}.email-octopus-form-row input::placeholder{color:#ccc}.email-octopus-form-row-hp{visibility:hidden}.cptui-intro-devblock{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row}.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}#menu_icon_preview{float:right;padding-left:8px}#menu_icon_preview img{display:block;height:20px;width:20px}.visuallyhidden{position:absolute;left:-10000px;top:auto;width:1px;height:1px;overflow:hidden}.cptui-spacer{display:block;margin-top:25px}.email-octopus-form-wrapper{background:#fff;margin-bottom:10px;padding:20px}.email-octopus-form-wrapper label{margin-bottom:10px}.wdsoctosignup h2{text-align:left}.wdspromos{float:right;margin-left:20px;margin-top:10px;width:275px}.wdspromos-about{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-wrap:nowrap;flex-wrap:nowrap;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-line-pack:stretch;align-content:stretch;-ms-flex-align:start;align-items:flex-start;margin:20px 0}.wdspromos-about a:first-child,.wdspromos-about a:nth-child(2),.wdspromos-about a:nth-child(3){-ms-flex-order:0;order:0;-ms-flex:0 1 auto;flex:0 1 auto;-ms-flex-item-align:auto;-ms-grid-row-align:auto;align-self:auto}.wdspromos-about p{padding:0 5px}.wdspromos-about p:first-child{padding-left:0}.wdspromos-about p:nth-child(4){padding-right:0}.no-js #cptui_choose_icon{display:none}.cptui-listings th{font-weight:700}.cptui-listings .post-type-listing th{width:16.66667%}.cptui-listings .taxonomy-listing th{width:20%}#poststuff{min-width:463px}@media screen and (min-width:769px){.cptui-badge{margin-top:-42px;height:173px;width:173px;color:#fafafa;font-weight:700;font-size:14px;text-align:center;margin-bottom:10px;background:url(../images/cptui-icon-173x173.png) no-repeat}}@media screen and (max-width:768px){.cptui-table #description{width:100%}.wdspromos-about{-ms-flex-wrap:wrap;flex-wrap:wrap}.wdspromos-about p{margin:5px auto}.wdspromos-about p:first-child{padding-left:5px}.wdspromos-about p:nth-child(4){padding-right:5px}#cptui_debug_info_email,.cptui-table td.outer{width:100%}}
\ No newline at end of file
diff --git a/css/cptui.scss b/css/cptui.scss
index 025d5a86..d1f342ed 100644
--- a/css/cptui.scss
+++ b/css/cptui.scss
@@ -29,19 +29,11 @@ $max-tablet: "screen and (max-width: 768px)";
}
}
.cptui-table {
- #excerpt {
- display: inline-block;
- height: 16px;
- margin: 12px 4px 12px 0;
- width: auto;
- }
td.outer {
vertical-align: top;
width: 50%;
}
- input[type="text"],
- .cptui-new & textarea,
- .cptui-edit & textarea {
+ input[type="text"] {
width: 75%;
}
.question:hover {
@@ -63,15 +55,6 @@ $max-tablet: "screen and (max-width: 768px)";
}
}
}
-.cpt-ui_page_cptui_tools {
- .cptui-table {
- .outer {
- p {
- padding: 0 4px;
- }
- }
- }
-}
.cptui-support #support {
.question {
@@ -173,20 +156,6 @@ $max-tablet: "screen and (max-width: 768px)";
}
}
}
-.rtl {
- .about-wrap {
- .feature-rest div {
- padding-left: 100px;
- }
- .feature-rest div.last-feature {
- padding-right: 100px;
- padding-left: 0;
- }
- .feature-rest div.icon:before {
- margin: 0 -100px 0 0;
- }
- }
-}
.about-wrap {
.about-integrations {
background: #fff;
@@ -209,17 +178,14 @@ $max-tablet: "screen and (max-width: 768px)";
color: #cccccc;
}
}
+.email-octopus-form-row-hp {
+ visibility: hidden;
+}
.cptui-intro-devblock{
display: flex;
flex-direction: row;
}
-#togglelabels {
- display: none;
- .js & {
- display: inline-block;
- }
-}
.cptui-help {
color: #424242;
margin-left: 4px;
@@ -248,13 +214,7 @@ $max-tablet: "screen and (max-width: 768px)";
width: 20px;
}
}
-#toplevel_page_cptui_main_menu {
- img {
- height: 20px;
- margin-top: -2px;
- width: 20px;
- }
-}
+
.visuallyhidden {
position: absolute;
left: -10000px;
diff --git a/custom-post-type-ui.php b/custom-post-type-ui.php
index 7422f399..5b07c069 100644
--- a/custom-post-type-ui.php
+++ b/custom-post-type-ui.php
@@ -16,7 +16,7 @@
* Plugin URI: https://github.com/WebDevStudios/custom-post-type-ui/
* Description: Admin panel for creating custom post types and custom taxonomies in WordPress
* Author: WebDevStudios
- * Version: 1.8.2
+ * Version: 1.9.0
* Author URI: https://webdevstudios.com/
* Text Domain: custom-post-type-ui
* Domain Path: /languages
@@ -30,8 +30,8 @@
exit;
}
-define( 'CPT_VERSION', '1.8.2' ); // Left for legacy purposes.
-define( 'CPTUI_VERSION', '1.8.2' );
+define( 'CPT_VERSION', '1.9.0' ); // Left for legacy purposes.
+define( 'CPTUI_VERSION', '1.9.0' );
define( 'CPTUI_WP_VERSION', get_bloginfo( 'version' ) );
/**
@@ -172,6 +172,10 @@ function cptui_plugin_menu() {
*/
function cptui_loaded() {
+ if ( class_exists( 'WPGraphQL' ) ) {
+ require_once plugin_dir_path( __FILE__ ) . 'external/wpgraphql.php';
+ }
+
/**
* Fires upon plugins_loaded WordPress hook.
*
diff --git a/external/wpgraphql.php b/external/wpgraphql.php
new file mode 100644
index 00000000..3496e68a
--- /dev/null
+++ b/external/wpgraphql.php
@@ -0,0 +1,329 @@
+show_in_graphql = isset( $data['cpt_custom_post_type']['show_in_graphql'] ) ? $data['cpt_custom_post_type']['show_in_graphql'] : false;
+ $this->graphql_single_name = isset( $data['cpt_custom_post_type']['graphql_single_name'] ) ? \WPGraphQL\Utils\Utils::format_type_name( $data['cpt_custom_post_type']['graphql_single_name'] ) : '';
+ $this->graphql_plural_name = isset( $data['cpt_custom_post_type']['graphql_plural_name'] ) ? \WPGraphQL\Utils\Utils::format_type_name( $data['cpt_custom_post_type']['graphql_plural_name'] ) : '';
+ }
+
+ /**
+ * Capture taxonomy settings from form submission for saving
+ *
+ * @param array $data
+ */
+ public function before_update_taxonomy( $data ) {
+ $this->show_in_graphql = isset( $data['cpt_custom_tax']['show_in_graphql'] ) ? $data['cpt_custom_tax']['show_in_graphql'] : false;
+ $this->graphql_single_name = isset( $data['cpt_custom_tax']['graphql_single_name'] ) ? \WPGraphQL\Utils\Utils::format_type_name( $data['cpt_custom_tax']['graphql_single_name'] ) : '';
+ $this->graphql_plural_name = isset( $data['cpt_custom_tax']['graphql_plural_name'] ) ? \WPGraphQL\Utils\Utils::format_type_name( $data['cpt_custom_tax']['graphql_plural_name'] ) : '';
+ }
+
+ /**
+ * Save values from form submission
+ *
+ * @param array $type
+ * @param string $name
+ *
+ * @return array
+ */
+ public function save_graphql_settings( $type, $name ) {
+ $type[ $name ]['show_in_graphql'] = $this->show_in_graphql;
+ $type[ $name ]['graphql_single_name'] = \WPGraphQL\Utils\Utils::format_type_name( $this->graphql_single_name );
+ $type[ $name ]['graphql_plural_name'] = \WPGraphQL\Utils\Utils::format_type_name( $this->graphql_plural_name );
+
+ return $type;
+ }
+
+ /**
+ * Add settings fields to Custom Post Type UI form
+ *
+ * @param cptui_admin_ui $ui Admin UI instance
+ */
+ public function add_graphql_post_type_settings( $ui ) {
+ $tab = ( ! empty( $_GET ) && ! empty( $_GET['action'] ) && 'edit' === $_GET['action'] ) ? 'edit' : 'new';
+ $current = [];
+ $name_array = 'cpt_custom_post_type';
+ if ( 'edit' === $tab ) {
+ $post_types = cptui_get_post_type_data();
+ $selected_post_type = cptui_get_current_post_type( false );
+ if ( $selected_post_type ) {
+ if ( array_key_exists( $selected_post_type, $post_types ) ) {
+ $current = $post_types[ $selected_post_type ];
+ }
+ }
+ }
+ echo $this->get_setting_fields( $ui, $current, $name_array );
+ }
+
+ /**
+ * Add settings fields to Custom Post Type UI form
+ *
+ * @param cptui_admin_ui $ui Admin UI instance
+ */
+ public function add_taxonomy_graphql_settings( $ui ) {
+ $tab = ( ! empty( $_GET ) && ! empty( $_GET['action'] ) && 'edit' === $_GET['action'] ) ? 'edit' : 'new';
+ $name_array = 'cpt_custom_tax';
+ $current = [];
+ if ( 'edit' === $tab ) {
+ $taxonomies = cptui_get_taxonomy_data();
+ $selected_taxonomy = cptui_get_current_taxonomy( false );
+ if ( $selected_taxonomy ) {
+ if ( array_key_exists( $selected_taxonomy, $taxonomies ) ) {
+ $current = $taxonomies[ $selected_taxonomy ];
+ }
+ }
+ }
+ echo $this->get_setting_fields( $ui, $current, $name_array );
+ }
+
+ /**
+ * Get the settings fields to render for the form
+ *
+ * @param cptui_admin_ui $ui Admin UI instance
+ * @param array $current
+ * @param string $name_array
+ */
+ public function get_setting_fields( $ui, $current, $name_array ) {
+ ?>
+
+ graphql_field_helpers();
+ }
+
+ /**
+ * JavaScript helpers to add conditional logic and support for the GraphQL setting fields
+ */
+ public function graphql_field_helpers() {
+ // This script provides helpers for the GraphQL fields in the CPT UI screen.
+ // If the Post Type or Taxonomy is not set to show_in_graphql the single/plural names
+ // should not be required.
+ ?>
+
+
+
+
de-active the "WPGraphQL for Custom Post Type UI" extension to proceed.', 'custom-post-type-ui' ), $link ); ?>
+
+ init();
+}
diff --git a/inc/about.php b/inc/about.php
index c3eef666..d1cd7080 100644
--- a/inc/about.php
+++ b/inc/about.php
@@ -85,12 +85,13 @@ function cptui_settings() {
-
-
-
+
+
+
', esc_url( 'https://wordpress.org/plugins/wp-graphql/' ) ),
+ ''
+ ); ?>
diff --git a/inc/listings.php b/inc/listings.php
index 0faa7178..ab046541 100644
--- a/inc/listings.php
+++ b/inc/listings.php
@@ -234,7 +234,7 @@ function cptui_listings() {
-
+
diff --git a/inc/post-types.php b/inc/post-types.php
index deb169f1..61b633cd 100644
--- a/inc/post-types.php
+++ b/inc/post-types.php
@@ -1955,7 +1955,6 @@ function cptui_process_post_type() {
add_filter( 'cptui_post_type_deleted', '__return_true' );
}
- // @TODO Utilize anonymous function to admin_notice `$result` if it happens to error.
if ( $result ) {
if ( is_callable( "cptui_{$result}_admin_notice" ) ) {
add_action( 'admin_notices', "cptui_{$result}_admin_notice" );
diff --git a/inc/taxonomies.php b/inc/taxonomies.php
index 6e251e52..d41553e7 100644
--- a/inc/taxonomies.php
+++ b/inc/taxonomies.php
@@ -1604,6 +1604,7 @@ function cptui_reserved_taxonomies() {
'term',
'theme',
'type',
+ 'types',
'w',
'withcomments',
'withoutcomments',
@@ -1740,7 +1741,6 @@ function cptui_process_taxonomy() {
add_filter( 'cptui_taxonomy_deleted', '__return_true' );
}
- // @TODO Utilize anonymous function to admin_notice `$result` if it happens to error.
if ( $result && is_callable( "cptui_{$result}_admin_notice" ) ) {
add_action( 'admin_notices', "cptui_{$result}_admin_notice" );
}
diff --git a/inc/utility.php b/inc/utility.php
index 82c5df9e..f3134b52 100644
--- a/inc/utility.php
+++ b/inc/utility.php
@@ -395,7 +395,7 @@ class="email-octopus-form"
- Subscribe
+ Subscribe
@@ -927,6 +927,10 @@ function cptui_post_type_supports( $post_type, $feature ) {
* @param array $post_types Array of CPTUI post types.
*/
function cptui_published_post_format_fix( $post_types ) {
+ if ( empty( $post_types ) || ! is_array( $post_types ) ) {
+ return;
+ }
+
foreach ( $post_types as $type ) {
if ( in_array( 'post-formats', $type['supports'], true ) ) {
add_post_type_support( $type['name'], 'post-formats' );
diff --git a/readme.txt b/readme.txt
index 46c2216c..d4dfe9f4 100644
--- a/readme.txt
+++ b/readme.txt
@@ -3,8 +3,8 @@ Contributors: webdevstudios, pluginize, tw2113, vegasgeek, modemlooper, williams
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3084056
Tags: custom post types, CPT, CMS, post, types, post type, taxonomy, tax, custom, content types, post types
Requires at least: 5.5
-Tested up to: 5.6.0
-Stable tag: 1.8.2
+Tested up to: 5.7.0
+Stable tag: 1.9.0
License: GPL-2.0+
Requires PHP: 5.6
@@ -31,6 +31,13 @@ Official development of Custom Post Type UI is on GitHub, with official stable r
== Changelog ==
+= 1.9.0 - 2021-03-30 =
+* Added: WPGraphQL Support when WPGraphQL is installed and active.
+* Fixed: Better handling of code in post_format based helper functions.
+* Updated: Cleaned up unused CSS.
+* Updated: Added `types` to disallowed taxonomy slugs.
+* Updated: Amended some helper text on the listings page regarding templates. Props @tarecord
+
= 1.8.2 - 2020-12-29 =
* Fixed: Addressed some missing available labels for taxonomies.
* Updated: Provide page slug and link to page if a post type slug is matching an existing page.
@@ -45,40 +52,15 @@ Official development of Custom Post Type UI is on GitHub, with official stable r
* Updated: Removed the forcing of underscores for post type slugs. Taxonomies are still forced.
* Fixed: jQuery compatibility issue with WordPress 5.5.0
-= 1.7.5 - 2020-08-11 =
-* Updated: Addressed UI issues with WordPress 5.5.0
-* Updated: Moved required minimum WordPress version to 5.5.0
-
-= 1.7.4 - 2020-03-17 =
-* Added: Nonce admin verification for import functionality.
-* Added: Extra escaping of markup and output for "Get Code" areas.
-
-= 1.7.3 - 2020-02-05 =
-* Updated: styles and appearance to better match WordPress core.
-* Updated: Change newsletter service integration. Hey, sign up for our newsletter! Props @Oceas
-
-= 1.7.2 - 2020-01-08 =
-* Fixed: Duplicate entries for "delete_with_user" in get code.
-* Fixed: Delete button for post types and taxonomies at bottom of page did not trigger dialog prompt.
-
-= 1.7.1 - 2019-11-06 =
-* Fixed: Random-ish redirects to the "Add new" tab for post types or taxonomies
-* Fixed: JavaScript error when trying to delete a taxonomy.
-
-= 1.7.0 - 2019-11-06 =
-* Actually added this time: Delete with user support for post types. Managed to miss the code with 1.6.0 which was a long time ago.
-* Added: Ability to disable registration of post types or taxonomies, via code filter, without deleting them completely from settings.
-* Added: New post type labels introduced in WordPress 5.0.0.
-* Added: Link to Dashicon documentation for when editing menu icon. Props @juliekuehl
-* Added: Ability to automatically fill in additional labels based on chosen plural and singular label text.
-* Updated: Added post type templates documentation to help section.
-* Updated: Redirect user to the "add" tab if deleting the last post type or taxonomy created.
-* Updated: Touched up tab markup to match semantic improvements provided by WordPress 5.2.0.
-* Fixed: potential duplicate output of "parent_item_colon" with "Get Code" output.
-* Misc: Added code of conduct file to github repo. Props GaryJones.
-
== Upgrade Notice ==
+= 1.9.0 - 2021-03-30 =
+* Added: WPGraphQL Support when WPGraphQL is installed and active.
+* Fixed: Better handling of code in post_format based helper functions.
+* Updated: Cleaned up unused CSS.
+* Updated: Added `types` to disallowed taxonomy slugs.
+* Updated: Amended some helper text on the listings page regarding templates. Props @tarecord
+
= 1.8.2 - 2020-12-29 =
* Fixed: Addressed some missing available labels for taxonomies.
* Updated: Provide page slug and link to page if a post type slug is matching an existing page.
@@ -93,38 +75,6 @@ Official development of Custom Post Type UI is on GitHub, with official stable r
* Updated: Removed the forcing of underscores for post type slugs. Taxonomies are still forced.
* Fixed: jQuery compatibility issue with WordPress 5.5.0
-= 1.7.5 - 2020-08-11 =
-* Updated: Addressed UI issues with WordPress 5.5.0
-* Updated: Moved required minimum WordPress version to 5.5.0
-
-= 1.7.4 - 2020-03-17 =
-* Added: Nonce admin verification for import functionality.
-* Added: Extra escaping of markup and output for "Get Code" areas.
-
-= 1.7.3 - 2020-02-05 =
-* Updated: styles and appearance to better match WordPress core.
-* Updated: Change newsletter service integration. Hey, sign up for our newsletter! Props @Oceas
-
-= 1.7.2 - 2020-01-08 =
-* Fixed: Duplicate entries for "delete_with_user" in get code.
-* Fixed: Delete button for post types and taxonomies at bottom of page did not trigger dialog prompt.
-
-= 1.7.1 - 2019-11-06 =
-* Fixed: Random-ish redirects to the "Add new" tab for post types or taxonomies
-* Fixed: JavaScript error when trying to delete a taxonomy.
-
-= 1.7.0 - 2019-11-06 =
-* Actually added this time: Delete with user support for post types. Managed to miss the code with 1.6.0 which was a long time ago.
-* Added: Ability to disable registration of post types or taxonomies, via code filter, without deleting them completely from settings.
-* Added: New post type labels introduced in WordPress 5.0.0.
-* Added: Link to Dashicon documentation for when editing menu icon. Props @juliekuehl
-* Added: Ability to automatically fill in additional labels based on chosen plural and singular label text.
-* Updated: Added post type templates documentation to help section.
-* Updated: Redirect user to the "add" tab if deleting the last post type or taxonomy created.
-* Updated: Touched up tab markup to match semantic improvements provided by WordPress 5.2.0.
-* Fixed: potential duplicate output of "parent_item_colon" with "Get Code" output.
-* Misc: Added code of conduct file to github repo. Props GaryJones.
-
== Installation ==
= Admin Installer via search =