summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Weipert <code@drogueronin.de>2021-03-18 15:54:11 +0100
committerDaniel Weipert <code@drogueronin.de>2021-03-18 15:54:11 +0100
commit143df0bab5534c3423f60a0062b580ffe26360e7 (patch)
treed276332d14a655e2eaf0af7535d40bfdca7e1511
parent26a80b7c2d4941abbfd51fd39459ac22612e18d7 (diff)
Fixes custom post type support
-rw-r--r--package-lock.json80
-rw-r--r--package.json5
-rw-r--r--readme.txt2
-rw-r--r--src/class-draggable-post-order.php19
-rw-r--r--src/index.js2
5 files changed, 62 insertions, 46 deletions
diff --git a/package-lock.json b/package-lock.json
index 5e8eb6c..62c5ad3 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -2549,6 +2549,12 @@
"requires": {
"type-fest": "^0.8.1"
}
+ },
+ "prettier": {
+ "version": "npm:wp-prettier@2.2.1-beta-1",
+ "resolved": "https://registry.npmjs.org/wp-prettier/-/wp-prettier-2.2.1-beta-1.tgz",
+ "integrity": "sha512-+JHkqs9LC/JPp51yy1hzs3lQ7qeuWCwOcSzpQNeeY/G7oSpnF61vxt7hRh87zNRTr6ob2ndy0W8rVzhgrcA+Gw==",
+ "dev": true
}
}
},
@@ -2659,6 +2665,43 @@
"webpack-bundle-analyzer": "^3.6.1",
"webpack-cli": "^3.3.11",
"webpack-livereload-plugin": "^2.3.0"
+ },
+ "dependencies": {
+ "prettier": {
+ "version": "npm:wp-prettier@2.2.1-beta-1",
+ "resolved": "https://registry.npmjs.org/wp-prettier/-/wp-prettier-2.2.1-beta-1.tgz",
+ "integrity": "sha512-+JHkqs9LC/JPp51yy1hzs3lQ7qeuWCwOcSzpQNeeY/G7oSpnF61vxt7hRh87zNRTr6ob2ndy0W8rVzhgrcA+Gw==",
+ "dev": true
+ },
+ "puppeteer": {
+ "version": "npm:puppeteer-core@3.0.0",
+ "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-3.0.0.tgz",
+ "integrity": "sha512-oWjZFGMc0q2ak+8OxdmMffS79LIT0UEtmpV4h1/AARvESIqqKljf8mrfP+dQ2kas7XttsAZIxRBuWu7Y5JH8KQ==",
+ "dev": true,
+ "requires": {
+ "@types/mime-types": "^2.1.0",
+ "debug": "^4.1.0",
+ "extract-zip": "^2.0.0",
+ "https-proxy-agent": "^4.0.0",
+ "mime": "^2.0.3",
+ "mime-types": "^2.1.25",
+ "progress": "^2.0.1",
+ "proxy-from-env": "^1.0.0",
+ "rimraf": "^3.0.2",
+ "tar-fs": "^2.0.0",
+ "unbzip2-stream": "^1.3.3",
+ "ws": "^7.2.3"
+ }
+ },
+ "rimraf": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
+ "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
+ "dev": true,
+ "requires": {
+ "glob": "^7.1.3"
+ }
+ }
}
},
"@wordpress/warning": {
@@ -11571,12 +11614,6 @@
"integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=",
"dev": true
},
- "prettier": {
- "version": "npm:wp-prettier@2.2.1-beta-1",
- "resolved": "https://registry.npmjs.org/wp-prettier/-/wp-prettier-2.2.1-beta-1.tgz",
- "integrity": "sha512-+JHkqs9LC/JPp51yy1hzs3lQ7qeuWCwOcSzpQNeeY/G7oSpnF61vxt7hRh87zNRTr6ob2ndy0W8rVzhgrcA+Gw==",
- "dev": true
- },
"prettier-linter-helpers": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz",
@@ -11781,37 +11818,6 @@
"integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==",
"dev": true
},
- "puppeteer": {
- "version": "npm:puppeteer-core@3.0.0",
- "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-3.0.0.tgz",
- "integrity": "sha512-oWjZFGMc0q2ak+8OxdmMffS79LIT0UEtmpV4h1/AARvESIqqKljf8mrfP+dQ2kas7XttsAZIxRBuWu7Y5JH8KQ==",
- "dev": true,
- "requires": {
- "@types/mime-types": "^2.1.0",
- "debug": "^4.1.0",
- "extract-zip": "^2.0.0",
- "https-proxy-agent": "^4.0.0",
- "mime": "^2.0.3",
- "mime-types": "^2.1.25",
- "progress": "^2.0.1",
- "proxy-from-env": "^1.0.0",
- "rimraf": "^3.0.2",
- "tar-fs": "^2.0.0",
- "unbzip2-stream": "^1.3.3",
- "ws": "^7.2.3"
- },
- "dependencies": {
- "rimraf": {
- "version": "3.0.2",
- "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
- "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
- "dev": true,
- "requires": {
- "glob": "^7.1.3"
- }
- }
- }
- },
"q": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz",
diff --git a/package.json b/package.json
index 78133a6..3fda1a6 100644
--- a/package.json
+++ b/package.json
@@ -5,7 +5,10 @@
"author": "Daniel Weipert <code@drogueronin.de>",
"license": "GPL-2.0-or-later",
"keywords": [
- "post-type", "custom-post-type", "order", "drag"
+ "post-type",
+ "custom-post-type",
+ "order",
+ "drag"
],
"homepage": "https://gitlab.com/DRogueRonin/wp-plugin-draggable-post-order",
"repository": "https://gitlab.com/DRogueRonin/wp-plugin-draggable-post-order",
diff --git a/readme.txt b/readme.txt
index 69ed5d6..a48c2ef 100644
--- a/readme.txt
+++ b/readme.txt
@@ -2,7 +2,7 @@
Contributors: drogueronin
Tags: post-type, custom-post-type, order, drag
Requires at least: 5.5
-Tested up to: 5.6
+Tested up to: 5.7
Stable tag: 1.0.0
Requires PHP: 7.4
License: GPLv2 or later
diff --git a/src/class-draggable-post-order.php b/src/class-draggable-post-order.php
index ee9156c..5645092 100644
--- a/src/class-draggable-post-order.php
+++ b/src/class-draggable-post-order.php
@@ -33,7 +33,7 @@ class Draggable_Post_Order {
*
* @var string
*/
- public static string $nonce = 'draggable-post-order';
+ public static string $nonce = '_draggable-post-order';
/**
* Initialize.
@@ -67,16 +67,23 @@ class Draggable_Post_Order {
}
/**
- * Whether the given post type is allowed to be ordered.
+ * Whether the given post type(s) are allowed to be ordered.
*
- * @param string $post_type The post type to check against.
+ * @param string $post_types The post type(s) to check against.
*
* @return bool
*/
- public static function supports( $post_type = null ) {
- $post_type ??= get_current_screen()->post_type ?? '';
+ public static function supports( $post_types = null ) {
+ $post_types ??= get_current_screen()->post_type ?? '';
+ $post_types = (array) $post_types;
- return post_type_supports( $post_type, self::$post_type_feature );
+ foreach ( $post_types as $post_type ) {
+ if ( ! post_type_supports( $post_type, self::$post_type_feature ) ) {
+ return false;
+ }
+ }
+
+ return true;
}
/**
diff --git a/src/index.js b/src/index.js
index 2a2623f..265b65a 100644
--- a/src/index.js
+++ b/src/index.js
@@ -37,7 +37,7 @@ import './index.scss';
action: 'update-post-order',
nonce: draggablePostOrder.nonce,
page: $( '#current-page-selector' ).val(),
- perPage: $( '#edit_post_per_page' ).val(),
+ perPage: $( '.screen-per-page' ).val(),
postOrder: $( '#the-list' ).sortable( 'serialize' ),
},
() => {