summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/class-draggable-post-order.php19
-rw-r--r--src/index.js2
2 files changed, 14 insertions, 7 deletions
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' ),
},
() => {