Simple Page Ordering - Version 2.3.4

Version Description

  • Changed: Avoid failed reordering introduced in v2.3.3 when handling a large number of non-hierarchical items (props @dinhtungdu)
  • Changed: Bump WordPress version support to 5.4 (props @tmoorewp)
  • Fixed: Ensure titles of reordered items appear in a human-readable way (props @dinhtungdu)
Download this release

Release Info

Developer 10upbot
Plugin Icon 128x128 Simple Page Ordering
Version 2.3.4
Comparing to
See all releases

Code changes from version 2.3.3 to 2.3.4

assets/js/simple-page-ordering.min.js CHANGED
@@ -1 +1 @@
1
- function update_simple_ordering_callback(e){if("children"!==e){var t=jQuery.parseJSON(e),r=t.new_pos;for(var n in r)if("next"!==n){var a=document.getElementById("inline_"+n);if(null!==a&&r.hasOwnProperty(n)){var o=a.querySelector(".menu_order");if(void 0!==r[n].menu_order){null!==o&&(o.textContent=r[n].menu_order);var l=a.querySelector(".post_parent");null!==l&&(l.textContent=r[n].post_parent);var i=null,s=a.querySelector(".post_title");null!==s&&(i=s.innerHTML);for(var d=0;d<r[n].depth;)i="&mdash; "+i,d++;var p=a.parentNode.querySelector(".row-title");null!==p&&null!==i&&(p.textContent=i)}else null!==o&&(o.textContent=r[n])}}t.next?jQuery.post(ajaxurl,{action:"simple_page_ordering",id:t.next.id,previd:t.next.previd,nextid:t.next.nextid,start:t.next.start,_wpnonce:simple_page_ordering_localized_data._wpnonce,screen_id:simple_page_ordering_localized_data.screen_id,excluded:JSON.stringify(t.next.excluded)},update_simple_ordering_callback):(jQuery(".spo-updating-row").removeClass("spo-updating-row").find(".check-column").removeClass("spinner is-active"),sortable_post_table.removeClass("spo-updating").sortable("enable"))}else window.location.reload()}var sortable_post_table=jQuery(".wp-list-table tbody");sortable_post_table.sortable({items:"> tr",cursor:"move",axis:"y",containment:"table.widefat",cancel:"input, textarea, button, select, option, .inline-edit-row",distance:2,opacity:.8,tolerance:"pointer",create:function(){jQuery(document).keydown(function(e){var t=e.key||e.keyCode;"Escape"!==t&&"Esc"!==t&&27!==t||(sortable_post_table.sortable("option","preventUpdate",!0),sortable_post_table.sortable("cancel"))})},start:function(e,t){"undefined"!=typeof inlineEditPost&&inlineEditPost.revert(),t.placeholder.height(t.item.height()),t.placeholder.empty()},helper:function(e,t){for(var r=t.children(),n=0;n<r.length;n++){var a=jQuery(r[n]);a.width(a.width())}return t},stop:function(e,t){sortable_post_table.sortable("option","preventUpdate")&&sortable_post_table.sortable("option","preventUpdate",!1),t.item.children().css("width","")},update:function(e,t){if(sortable_post_table.sortable("option","preventUpdate"))sortable_post_table.sortable("option","preventUpdate",!1);else{sortable_post_table.sortable("disable").addClass("spo-updating"),t.item.addClass("spo-updating-row"),t.item.find(".check-column").addClass("spinner is-active");var r=t.item[0].id.substr(5),n=!1,a=t.item.prev();0<a.length&&(n=a.attr("id").substr(5));var o=!1,l=t.item.next();0<l.length&&(o=l.attr("id").substr(5)),jQuery.post(ajaxurl,{action:"simple_page_ordering",id:r,previd:n,nextid:o,_wpnonce:simple_page_ordering_localized_data._wpnonce,screen_id:simple_page_ordering_localized_data.screen_id},update_simple_ordering_callback);for(var i=document.querySelectorAll("tr.iedit"),s=i.length;s--;)0==s%2?jQuery(i[s]).addClass("alternate"):jQuery(i[s]).removeClass("alternate")}}});
1
+ function update_simple_ordering_callback(e){if("children"!==e){var t=jQuery.parseJSON(e),r=t.new_pos;for(var a in r)if("next"!==a){var n=document.getElementById("inline_"+a);if(null!==n&&r.hasOwnProperty(a)){var o=n.querySelector(".menu_order");if(void 0!==r[a].menu_order){null!==o&&(o.textContent=r[a].menu_order);var l=n.querySelector(".post_parent");null!==l&&(l.textContent=r[a].post_parent);var i=null,s=n.querySelector(".post_title");null!==s&&(i=s.innerHTML);for(var d=0;d<r[a].depth;)i="&mdash; "+i,d++;var p=n.parentNode.querySelector(".row-title");if(null!==p&&null!==i){var c=document.createElement("textarea");c.innerHTML=i,p.textContent=c.value}}else null!==o&&(o.textContent=r[a])}}t.next?jQuery.post(ajaxurl,{action:"simple_page_ordering",id:t.next.id,previd:t.next.previd,nextid:t.next.nextid,start:t.next.start,_wpnonce:simple_page_ordering_localized_data._wpnonce,screen_id:simple_page_ordering_localized_data.screen_id,excluded:JSON.stringify(t.next.excluded)},update_simple_ordering_callback):(jQuery(".spo-updating-row").removeClass("spo-updating-row").find(".check-column").removeClass("spinner is-active"),sortable_post_table.removeClass("spo-updating").sortable("enable"))}else window.location.reload()}var sortable_post_table=jQuery(".wp-list-table tbody");sortable_post_table.sortable({items:"> tr",cursor:"move",axis:"y",containment:"table.widefat",cancel:"input, textarea, button, select, option, .inline-edit-row",distance:2,opacity:.8,tolerance:"pointer",create:function(){jQuery(document).keydown(function(e){var t=e.key||e.keyCode;"Escape"!==t&&"Esc"!==t&&27!==t||(sortable_post_table.sortable("option","preventUpdate",!0),sortable_post_table.sortable("cancel"))})},start:function(e,t){"undefined"!=typeof inlineEditPost&&inlineEditPost.revert(),t.placeholder.height(t.item.height()),t.placeholder.empty()},helper:function(e,t){for(var r=t.children(),a=0;a<r.length;a++){var n=jQuery(r[a]);n.width(n.width())}return t},stop:function(e,t){sortable_post_table.sortable("option","preventUpdate")&&sortable_post_table.sortable("option","preventUpdate",!1),t.item.children().css("width","")},update:function(e,t){if(sortable_post_table.sortable("option","preventUpdate"))sortable_post_table.sortable("option","preventUpdate",!1);else{sortable_post_table.sortable("disable").addClass("spo-updating"),t.item.addClass("spo-updating-row"),t.item.find(".check-column").addClass("spinner is-active");var r=t.item[0].id.substr(5),a=!1,n=t.item.prev();0<n.length&&(a=n.attr("id").substr(5));var o=!1,l=t.item.next();0<l.length&&(o=l.attr("id").substr(5)),jQuery.post(ajaxurl,{action:"simple_page_ordering",id:r,previd:a,nextid:o,_wpnonce:simple_page_ordering_localized_data._wpnonce,screen_id:simple_page_ordering_localized_data.screen_id},update_simple_ordering_callback);for(var i=document.querySelectorAll("tr.iedit"),s=i.length;s--;)0==s%2?jQuery(i[s]).addClass("alternate"):jQuery(i[s]).removeClass("alternate")}}});
assets/js/src/simple-page-ordering.js CHANGED
@@ -39,7 +39,10 @@ function update_simple_ordering_callback(response) {
39
}
40
var dom_row_title = inline_key.parentNode.querySelector('.row-title');
41
if ( null !== dom_row_title && null !== post_title ) {
42
- dom_row_title.textContent = post_title;
43
}
44
} else if ( null !== dom_menu_order ) {
45
dom_menu_order.textContent = new_pos[key];
39
}
40
var dom_row_title = inline_key.parentNode.querySelector('.row-title');
41
if ( null !== dom_row_title && null !== post_title ) {
42
+ // Decode mdash character before rendering the title.
43
+ var textArea = document.createElement('textarea');
44
+ textArea.innerHTML = post_title;
45
+ dom_row_title.textContent = textArea.value;
46
}
47
} else if ( null !== dom_menu_order ) {
48
dom_menu_order.textContent = new_pos[key];
composer.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "10up/simple-page-ordering",
3
+ "description": "Order your pages and other hierarchical post types with simple drag and drop right from the standard page list.",
4
+ "version": "2.3.4",
5
+ "type": "wordpress-plugin",
6
+ "keywords": [
7
+ "wordpress",
8
+ "10up"
9
+ ],
10
+ "homepage": "https://github.com/10up/simple-page-ordering",
11
+ "license": "GPLv2",
12
+ "authors": [
13
+ {
14
+ "name": "10up",
15
+ "homepage": "https://10up.com/"
16
+ }
17
+ ],
18
+ "support": {
19
+ "issues": "https://github.com/10up/simple-page-ordering/issues",
20
+ "source": "https://github.com/10up/simple-page-ordering"
21
+ },
22
+ "minimum-stability": "dev",
23
+ "require-dev": {
24
+ "10up/wpacceptance": "dev-master"
25
+ }
26
+ }
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: 10up, jakemgold, welcher, helen, thinkoomph
3
Donate link: http://10up.com/plugins/simple-page-ordering-wordpress/
4
Tags: order, re-order, ordering, pages, page, manage, menu_order, hierarchical, ajax, drag-and-drop, admin
5
Requires at least: 3.8
6
- Tested up to: 5.3
7
- Stable tag: 2.3.3
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
@@ -26,14 +26,12 @@ Please note that the plug-in is not compatible with Internet Explorer 7 and earl
26
27
We'd love to have you join in on development over on [GitHub](https://github.com/10up/simple-page-ordering).
28
29
-
30
== Installation ==
31
32
1. Install either via the WordPress.org plugin directory, or by uploading the files to your server.
33
1. Activate the plugin through the 'Plugins' menu in WordPress.
34
1. Get to work reordering your content!
35
36
-
37
== Frequently Asked Questions ==
38
39
= Why can't I reorder my posts? =
@@ -74,15 +72,18 @@ Where 5 is the number of items to batch on each request (the default is 50). Not
74
75
This feature is already built into WordPress natively, but a bit tucked away. If you pull down the "Screen Options" tab up top (on the list of post objects) there's a field where you can specify the number of items to show per page. I decided it was not a very good practice to duplicate this.
76
77
-
78
== Screenshots ==
79
80
1. Dragging the page to its new position
81
1. Processing indicator
82
83
-
84
== Changelog ==
85
86
= 2.3.3 =
87
* **Added:** Nonce verify for AJAX requests (props [@williampatton](https://profiles.wordpress.org/williampatton/), [@dtbaker](https://profiles.wordpress.org/dtbaker/))
88
* **Changed:** Disable Post Revisions now using the correct action of `post_updated` (props [@blue-liquid-designs](https://profiles.wordpress.org/blue-liquid-designs/))
3
Donate link: http://10up.com/plugins/simple-page-ordering-wordpress/
4
Tags: order, re-order, ordering, pages, page, manage, menu_order, hierarchical, ajax, drag-and-drop, admin
5
Requires at least: 3.8
6
+ Tested up to: 5.4
7
+ Stable tag: 2.3.4
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
26
27
We'd love to have you join in on development over on [GitHub](https://github.com/10up/simple-page-ordering).
28
29
== Installation ==
30
31
1. Install either via the WordPress.org plugin directory, or by uploading the files to your server.
32
1. Activate the plugin through the 'Plugins' menu in WordPress.
33
1. Get to work reordering your content!
34
35
== Frequently Asked Questions ==
36
37
= Why can't I reorder my posts? =
72
73
This feature is already built into WordPress natively, but a bit tucked away. If you pull down the "Screen Options" tab up top (on the list of post objects) there's a field where you can specify the number of items to show per page. I decided it was not a very good practice to duplicate this.
74
75
== Screenshots ==
76
77
1. Dragging the page to its new position
78
1. Processing indicator
79
80
== Changelog ==
81
82
+ = 2.3.4 =
83
+ * **Changed:** Avoid failed reordering introduced in v2.3.3 when handling a large number of non-hierarchical items (props [@dinhtungdu](https://profiles.wordpress.org/dinhtungdu/))
84
+ * **Changed:** Bump WordPress version support to 5.4 (props [@tmoorewp](https://profiles.wordpress.org/tmoorewp/))
85
+ * **Fixed:** Ensure titles of reordered items appear in a human-readable way (props [@dinhtungdu](https://profiles.wordpress.org/dinhtungdu/))
86
+
87
= 2.3.3 =
88
* **Added:** Nonce verify for AJAX requests (props [@williampatton](https://profiles.wordpress.org/williampatton/), [@dtbaker](https://profiles.wordpress.org/dtbaker/))
89
* **Changed:** Disable Post Revisions now using the correct action of `post_updated` (props [@blue-liquid-designs](https://profiles.wordpress.org/blue-liquid-designs/))
simple-page-ordering.php CHANGED
@@ -3,7 +3,7 @@
3
* Plugin Name: Simple Page Ordering
4
* Plugin URI: http://10up.com/plugins/simple-page-ordering-wordpress/
5
* Description: Order your pages and hierarchical post types using drag and drop on the built in page list. For further instructions, open the "Help" tab on the Pages screen.
6
- * Version: 2.3.3
7
* Requires at least: 3.8
8
* Author: Jake Goldman, 10up
9
* Author URI: https://10up.com
@@ -190,6 +190,7 @@ if ( ! class_exists( 'Simple_Page_Ordering' ) ) :
190
'post_type' => $post->post_type,
191
'post_status' => $post_stati,
192
'post_parent' => $parent_id,
193
'orderby' => array(
194
'menu_order' => 'ASC',
195
'title' => 'ASC',
@@ -211,11 +212,6 @@ if ( ! class_exists( 'Simple_Page_Ordering' ) ) :
211
remove_action( 'post_updated', 'wp_save_post_revision' );
212
213
foreach ( $siblings->posts as $sibling ) :
214
- // Skip the excluded posts.
215
- if ( in_array( $sibling->ID, $excluded, true ) ) {
216
- continue;
217
- }
218
-
219
// don't handle the actual post
220
if ( $sibling->ID === $post->ID ) {
221
continue;
3
* Plugin Name: Simple Page Ordering
4
* Plugin URI: http://10up.com/plugins/simple-page-ordering-wordpress/
5
* Description: Order your pages and hierarchical post types using drag and drop on the built in page list. For further instructions, open the "Help" tab on the Pages screen.
6
+ * Version: 2.3.4
7
* Requires at least: 3.8
8
* Author: Jake Goldman, 10up
9
* Author URI: https://10up.com
190
'post_type' => $post->post_type,
191
'post_status' => $post_stati,
192
'post_parent' => $parent_id,
193
+ 'post__not_in' => $excluded, // phpcs:ignore
194
'orderby' => array(
195
'menu_order' => 'ASC',
196
'title' => 'ASC',
212
remove_action( 'post_updated', 'wp_save_post_revision' );
213
214
foreach ( $siblings->posts as $sibling ) :
215
// don't handle the actual post
216
if ( $sibling->ID === $post->ID ) {
217
continue;