Simple Page Ordering - Version 2.4.3

Version Description

  • 2022-11-08 =
  • Changed: Allow hierarchical post types that don't have page-attributes set to be sorted properly (props @dkotter, @peterwilsoncc via #108.
  • Security: Bump got from 10.7.0 to 11.8.5 (props @dependabot via #106.
  • Security: Bump @wordpress/env from 4.9.0 to 5.3.0 (props @dependabot via #106.
  • Security: Bump scss-tokenizer from 0.3.0 to 0.4.3 (props @dependabot via #107.
  • Security: Bump node-sass from 7.0.1 to 7.0.3 (props @dependabot via #107.
Download this release

Release Info

Developer 10up
Plugin Icon 128x128 Simple Page Ordering
Version 2.4.3
Comparing to
See all releases

Code changes from version 2.4.2 to 2.4.3

localization/simple-page-ordering.pot CHANGED
@@ -2,10 +2,10 @@
2
  # This file is distributed under the GPLv2 or later.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Simple Page Ordering 2.4.2\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://wordpress.org/support/plugin/simple-page-ordering\n"
8
- "POT-Creation-Date: 2022-09-28 16:13:24+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
@@ -14,45 +14,45 @@ msgstr ""
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
15
  "X-Generator: node-wp-i18n 1.2.6\n"
16
 
17
- #: simple-page-ordering.php:143
18
  msgid ""
19
  "It looks like you are using a development copy of <strong>Simple Page "
20
  "Ordering</strong>. Please run <code>npm i; npm run build</code> to create "
21
  "assets."
22
  msgstr ""
23
 
24
- #: simple-page-ordering.php:161
25
  msgid ""
26
  "To reposition an item, simply drag and drop the row by \"clicking and "
27
  "holding\" it anywhere (outside of the links and form controls) and moving "
28
  "it to its new position."
29
  msgstr ""
30
 
31
- #: simple-page-ordering.php:226 simple-page-ordering.php:501
32
  msgid "Missing mandatory parameters."
33
  msgstr ""
34
 
35
- #: simple-page-ordering.php:424
36
  msgid "Sort by Order"
37
  msgstr ""
38
 
39
- #: simple-page-ordering.php:456
40
  msgid "Post ID."
41
  msgstr ""
42
 
43
- #: simple-page-ordering.php:461
44
  msgid "Previous post ID"
45
  msgstr ""
46
 
47
- #: simple-page-ordering.php:466
48
  msgid "Next post ID"
49
  msgstr ""
50
 
51
- #: simple-page-ordering.php:472
52
  msgid "Start index"
53
  msgstr ""
54
 
55
- #: simple-page-ordering.php:478
56
  msgid "Array of excluded post IDs"
57
  msgstr ""
58
 
2
  # This file is distributed under the GPLv2 or later.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Simple Page Ordering 2.4.3\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://wordpress.org/support/plugin/simple-page-ordering\n"
8
+ "POT-Creation-Date: 2022-11-08 18:06:01+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
15
  "X-Generator: node-wp-i18n 1.2.6\n"
16
 
17
+ #: simple-page-ordering.php:153
18
  msgid ""
19
  "It looks like you are using a development copy of <strong>Simple Page "
20
  "Ordering</strong>. Please run <code>npm i; npm run build</code> to create "
21
  "assets."
22
  msgstr ""
23
 
24
+ #: simple-page-ordering.php:171
25
  msgid ""
26
  "To reposition an item, simply drag and drop the row by \"clicking and "
27
  "holding\" it anywhere (outside of the links and form controls) and moving "
28
  "it to its new position."
29
  msgstr ""
30
 
31
+ #: simple-page-ordering.php:236 simple-page-ordering.php:510
32
  msgid "Missing mandatory parameters."
33
  msgstr ""
34
 
35
+ #: simple-page-ordering.php:433
36
  msgid "Sort by Order"
37
  msgstr ""
38
 
39
+ #: simple-page-ordering.php:465
40
  msgid "Post ID."
41
  msgstr ""
42
 
43
+ #: simple-page-ordering.php:470
44
  msgid "Previous post ID"
45
  msgstr ""
46
 
47
+ #: simple-page-ordering.php:475
48
  msgid "Next post ID"
49
  msgstr ""
50
 
51
+ #: simple-page-ordering.php:481
52
  msgid "Start index"
53
  msgstr ""
54
 
55
+ #: simple-page-ordering.php:487
56
  msgid "Array of excluded post IDs"
57
  msgstr ""
58
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ 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: 6.0
7
- Stable tag: 2.4.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -46,6 +46,8 @@ Yep. When you register the post type, include the `page-attributes` feature in t
46
 
47
  `'supports' => array( 'title', 'editor', 'page-attributes' ),`
48
 
 
 
49
  You can also take advantage of the `simple_page_ordering_is_sortable` filter, which passes the result of the default check and the post type name, to override default behavior.
50
 
51
  = I want my non-hierarchical post type to be sortable. Help! =
@@ -70,11 +72,11 @@ Where 5 is the number of items to batch on each request (the default is 50). Not
70
 
71
  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.
72
 
73
- = How can I exclude certain custom post types? =
74
 
75
- Custom post types can be excluded by using the `simple_page_ordering_is_sortable` filter.
76
 
77
- For example, with `excluded_post_type` as the custom post type ID, add the following snippet in the theme function file or custom plugin:
78
 
79
  `
80
  add_filter( 'simple_page_ordering_is_sortable', function( $sortable, $post_type ) {
@@ -85,6 +87,17 @@ add_filter( 'simple_page_ordering_is_sortable', function( $sortable, $post_type
85
  }, 10, 2 );
86
  `
87
 
 
 
 
 
 
 
 
 
 
 
 
88
  = Can I use REST to order posts? =
89
 
90
  Yes. The plugin registers the REST endpoint `simple-page-ordering/v1/page_ordering`.
@@ -96,6 +109,13 @@ Yes. The plugin registers the REST endpoint `simple-page-ordering/v1/page_orderi
96
 
97
  == Changelog ==
98
 
 
 
 
 
 
 
 
99
  = 2.4.2 - 2022-09-28 =
100
  * **Changed:** Replaced our Grunt build process with `10up-toolkit` (props [@cadic](https://github.com/cadic), [@peterwilsoncc](https://github.com/peterwilsoncc), [@dinhtungdu](https://github.com/dinhtungdu) via [#97](https://github.com/10up/simple-page-ordering/pull/97).
101
  * **Fixed:** Disable reordering for CPTs that don't support `page-attributes` (props [@dhanendran](https://github.com/dhanendran), [@dinhtungdu](https://github.com/dinhtungdu), [@peterwilsoncc](https://github.com/peterwilsoncc) via [#103](https://github.com/10up/simple-page-ordering/pull/103).
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: 6.0
7
+ Stable tag: 2.4.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
46
 
47
  `'supports' => array( 'title', 'editor', 'page-attributes' ),`
48
 
49
+ Alternatively, when you register the post type, set `hierarchical` to `true` - hierarchical post types natively order by menu order.
50
+
51
  You can also take advantage of the `simple_page_ordering_is_sortable` filter, which passes the result of the default check and the post type name, to override default behavior.
52
 
53
  = I want my non-hierarchical post type to be sortable. Help! =
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
+ = How can I modify sortable post types? =
76
 
77
+ Post types can be included or excluded by using the `simple_page_ordering_is_sortable` filter.
78
 
79
+ For example, to exclude the `excluded_post_type` custom post type, add the following snippet in the theme function file or custom plugin:
80
 
81
  `
82
  add_filter( 'simple_page_ordering_is_sortable', function( $sortable, $post_type ) {
87
  }, 10, 2 );
88
  `
89
 
90
+ To include the `include_post_type` custom post type, add the following snippet in the theme function file or custom plugin:
91
+
92
+ ```
93
+ add_filter( 'simple_page_ordering_is_sortable', function( $sortable, $post_type ) {
94
+ if ( 'include_post_type' === $post_type ) {
95
+ return true;
96
+ }
97
+ return $sortable;
98
+ }, 10, 2 );
99
+ ```
100
+
101
  = Can I use REST to order posts? =
102
 
103
  Yes. The plugin registers the REST endpoint `simple-page-ordering/v1/page_ordering`.
109
 
110
  == Changelog ==
111
 
112
+ = 2.4.3 - 2022-11-08 =
113
+ * **Changed:** Allow hierarchical post types that don't have `page-attributes` set to be sorted properly (props [@dkotter](https://github.com/dkotter), [@peterwilsoncc](https://github.com/peterwilsoncc) via [#108](https://github.com/10up/simple-page-ordering/pull/108).
114
+ * **Security:** Bump `got` from 10.7.0 to 11.8.5 (props [@dependabot](https://github.com/apps/dependabot) via [#106](https://github.com/10up/simple-page-ordering/pull/106).
115
+ * **Security:** Bump `@wordpress/env` from 4.9.0 to 5.3.0 (props [@dependabot](https://github.com/apps/dependabot) via [#106](https://github.com/10up/simple-page-ordering/pull/106).
116
+ * **Security:** Bump `scss-tokenizer` from 0.3.0 to 0.4.3 (props [@dependabot](https://github.com/apps/dependabot) via [#107](https://github.com/10up/simple-page-ordering/pull/107).
117
+ * **Security:** Bump `node-sass` from 7.0.1 to 7.0.3 (props [@dependabot](https://github.com/apps/dependabot) via [#107](https://github.com/10up/simple-page-ordering/pull/107).
118
+
119
  = 2.4.2 - 2022-09-28 =
120
  * **Changed:** Replaced our Grunt build process with `10up-toolkit` (props [@cadic](https://github.com/cadic), [@peterwilsoncc](https://github.com/peterwilsoncc), [@dinhtungdu](https://github.com/dinhtungdu) via [#97](https://github.com/10up/simple-page-ordering/pull/97).
121
  * **Fixed:** Disable reordering for CPTs that don't support `page-attributes` (props [@dhanendran](https://github.com/dhanendran), [@dinhtungdu](https://github.com/dinhtungdu), [@peterwilsoncc](https://github.com/peterwilsoncc) via [#103](https://github.com/10up/simple-page-ordering/pull/103).
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.4.2
7
  * Requires at least: 3.8
8
  * Author: Jake Goldman, 10up
9
  * Author URI: https://10up.com
@@ -15,7 +15,7 @@
15
  */
16
 
17
  // Useful global constants.
18
- define( 'SIMPLE_PAGE_ORDERING_VERSION', '2.4.2' );
19
 
20
  if ( ! class_exists( 'Simple_Page_Ordering' ) ) :
21
 
@@ -73,7 +73,17 @@ if ( ! class_exists( 'Simple_Page_Ordering' ) ) :
73
  * @return boolean
74
  */
75
  private static function is_post_type_sortable( $post_type = 'post' ) {
76
- return apply_filters( 'simple_page_ordering_is_sortable', post_type_supports( $post_type, 'page-attributes' ), $post_type );
 
 
 
 
 
 
 
 
 
 
77
  }
78
 
79
  /**
@@ -416,8 +426,7 @@ if ( ! class_exists( 'Simple_Page_Ordering' ) ) :
416
  public static function sort_by_order_link( $views ) {
417
  $class = ( get_query_var( 'orderby' ) === 'menu_order title' ) ? 'current' : '';
418
  $query_string = remove_query_arg( array( 'orderby', 'order' ) );
419
- $sortable = self::is_post_type_sortable( get_post_type() );
420
- if ( $sortable ) {
421
  $query_string = add_query_arg( 'orderby', 'menu_order title', $query_string );
422
  $query_string = add_query_arg( 'order', 'asc', $query_string );
423
  }
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.4.3
7
  * Requires at least: 3.8
8
  * Author: Jake Goldman, 10up
9
  * Author URI: https://10up.com
15
  */
16
 
17
  // Useful global constants.
18
+ define( 'SIMPLE_PAGE_ORDERING_VERSION', '2.4.3' );
19
 
20
  if ( ! class_exists( 'Simple_Page_Ordering' ) ) :
21
 
73
  * @return boolean
74
  */
75
  private static function is_post_type_sortable( $post_type = 'post' ) {
76
+ $sortable = ( post_type_supports( $post_type, 'page-attributes' ) || is_post_type_hierarchical( $post_type ) );
77
+
78
+ /**
79
+ * Change default ordering support for a post type.
80
+ *
81
+ * @since 2.0.0
82
+ *
83
+ * @param boolean $sortable Whether this post type is sortable or not.
84
+ * @param string $post_type The post type being checked.
85
+ */
86
+ return apply_filters( 'simple_page_ordering_is_sortable', $sortable, $post_type );
87
  }
88
 
89
  /**
426
  public static function sort_by_order_link( $views ) {
427
  $class = ( get_query_var( 'orderby' ) === 'menu_order title' ) ? 'current' : '';
428
  $query_string = remove_query_arg( array( 'orderby', 'order' ) );
429
+ if ( ! is_post_type_hierarchical( get_post_type() ) ) {
 
430
  $query_string = add_query_arg( 'orderby', 'menu_order title', $query_string );
431
  $query_string = add_query_arg( 'order', 'asc', $query_string );
432
  }