Intuitive Custom Post Order - Version 3.0.8

Version Description

  • Even for 'get_posts()', Your custom Query which uses the 'order' or 'orderby' parameters is preferred. ATTENTION: Only if you use 'get_posts()' to re-overwrite to the default order( orderby=date, order=DESC ), You need to use own custom parameter 'orderby=default_date'.
Download this release

Release Info

Developer hijiri
Plugin Icon 128x128 Intuitive Custom Post Order
Version 3.0.8
Comparing to
See all releases

Code changes from version 3.0.7 to 3.0.8

Files changed (3) hide show
  1. README.md +2 -2
  2. intuitive-custom-post-order.php +7 -3
  3. readme.txt +30 -5
README.md CHANGED
@@ -8,8 +8,8 @@ Intuitively, order items( Posts, Pages, and Custom Post Types, and Custom Taxono
8
 
9
  Select sortable items from 'Intuitive CPT' menu of Setting menu in WordPress.
10
 
11
- In addition, You can re-override the parameters of `orderby` and `order`, by using the `WP_Query` or `pre_get_posts` or `query_posts`.<br>
12
- The `get_posts()` is excluded.
13
 
14
  ## Installation
15
 
8
 
9
  Select sortable items from 'Intuitive CPT' menu of Setting menu in WordPress.
10
 
11
+ In addition, You can re-override the parameters of `orderby` and `order`, by using the `WP_Query` or `pre_get_posts` or `query_posts()` or `get_posts()`.<br>
12
+ ATTENTION: Only if you use `get_posts()` to re-overwrite to the default order( `orderby=date, order=DESC` ), You need to use own custom parameter `orderby=default_date`.
13
 
14
  ## Installation
15
 
intuitive-custom-post-order.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Intuitive Custom Post Order
4
  * Plugin URI: http://hijiriworld.com/web/plugins/intuitive-custom-post-order/
5
  * Description: Intuitively, Order Items (Posts, Pages, and Custom Post Types and Custom Taxonomies) using a Drag and Drop Sortable JavaScript.
6
- * Version: 3.0.7
7
  * Author: hijiri
8
  * Author URI: http://hijiriworld.com/web/
9
  * Text Domain: intuitive-custom-post-order
@@ -459,8 +459,12 @@ class Hicpo
459
 
460
  // get_posts()
461
  if ( isset( $wp_query->query['suppress_filters'] ) ) {
462
- if ( $wp_query->get( 'orderby' ) == 'date' ) $wp_query->set( 'orderby', 'menu_order' );
463
- if ( $wp_query->get( 'order' ) == 'DESC' ) $wp_query->set( 'order', 'ASC' );
 
 
 
 
464
  // WP_Query( contain main_query )
465
  } else {
466
  if ( !$wp_query->get( 'orderby' ) ) $wp_query->set( 'orderby', 'menu_order' );
3
  * Plugin Name: Intuitive Custom Post Order
4
  * Plugin URI: http://hijiriworld.com/web/plugins/intuitive-custom-post-order/
5
  * Description: Intuitively, Order Items (Posts, Pages, and Custom Post Types and Custom Taxonomies) using a Drag and Drop Sortable JavaScript.
6
+ * Version: 3.0.8
7
  * Author: hijiri
8
  * Author URI: http://hijiriworld.com/web/
9
  * Text Domain: intuitive-custom-post-order
459
 
460
  // get_posts()
461
  if ( isset( $wp_query->query['suppress_filters'] ) ) {
462
+ if ( $wp_query->get( 'orderby' ) == 'date' || $wp_query->get( 'orderby' ) == 'menu_order' ) {
463
+ $wp_query->set( 'orderby', 'menu_order' );
464
+ $wp_query->set( 'order', 'ASC' );
465
+ } elseif($wp_query->get( 'orderby' ) == 'default_date') {
466
+ $wp_query->set( 'orderby', 'date' );
467
+ }
468
  // WP_Query( contain main_query )
469
  } else {
470
  if ( !$wp_query->get( 'orderby' ) ) $wp_query->set( 'orderby', 'menu_order' );
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: hijiri
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=TT5NP352P6MCU
4
  Tags: post order, posts order, order post, order posts, custom post type order, custom taxonomy order
5
  Requires at least: 3.5.0
6
- Tested up to: 4.3.1
7
  Stable tag: 3.0.7
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -16,8 +16,8 @@ Intuitively, order items( Posts, Pages, and Custom Post Types, and Custom Taxono
16
 
17
  Select sortable items from 'Intuitive CPT' menu of Setting menu in WordPress.
18
 
19
- In addition, You can re-override the parameters of 'orderby' and 'order', by using the 'WP_Query' or 'pre_get_posts' or 'query_posts()'.<br>
20
- The 'get_posts()' is excluded.
21
 
22
  This Plugin published on <a href="https://github.com/hijiriworld/intuitive-custom-post-order">GitHub.</a>
23
 
@@ -45,7 +45,24 @@ By using the 'WP_Query', you can re-override the parameters.
45
 
46
  `
47
  <?php $query = new WP_Query( array(
48
- 'orderby' => 'date',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  'order' => 'DESC',
50
  ) ) ?>
51
  `
@@ -76,9 +93,17 @@ add_action( 'pre_get_posts', 'my_filter' );
76
  'orderby' => 'rand'
77
  ) ); ?>
78
  `
 
 
 
79
 
80
  == Changelog ==
81
 
 
 
 
 
 
82
  = 3.0.7 =
83
 
84
  * This plugin will imported listed above into the translate.wordpress.org translation system. Language packs will also be enabled for this plugin, for any locales that are fully translated (at 100%).
@@ -95,7 +120,7 @@ add_action( 'pre_get_posts', 'my_filter' );
95
 
96
  = 3.0.4 =
97
 
98
- * Your Query which uses the 'order' or 'orderby' parameters is preferred.
99
  In order to prefer the parameters of your query, You must use the 'WP_Query()' or 'query_posts()'.
100
  Excluded 'get_posts()'.
101
  * Fixed bug
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=TT5NP352P6MCU
4
  Tags: post order, posts order, order post, order posts, custom post type order, custom taxonomy order
5
  Requires at least: 3.5.0
6
+ Tested up to: 4.7.3
7
  Stable tag: 3.0.7
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
16
 
17
  Select sortable items from 'Intuitive CPT' menu of Setting menu in WordPress.
18
 
19
+ In addition, You can re-override the parameters of 'orderby' and 'order', by using the 'WP_Query' or 'pre_get_posts' or 'query_posts()' or 'get_posts()'.<br>
20
+ ATTENTION: Only if you use 'get_posts()' to re-overwrite to the default order( orderby=date, order=DESC ), You need to use own custom parameter 'orderby=default_date'.
21
 
22
  This Plugin published on <a href="https://github.com/hijiriworld/intuitive-custom-post-order">GitHub.</a>
23
 
45
 
46
  `
47
  <?php $query = new WP_Query( array(
48
+ 'orderby' => 'ID',
49
+ 'order' => 'DESC',
50
+ ) ) ?>
51
+ `
52
+
53
+ * get_posts()
54
+
55
+ `
56
+ <?php $query = get_posts( array(
57
+ 'orderby' => 'title',
58
+ ) ) ?>
59
+ `
60
+
61
+ ATTENTION: Only if you use 'get_posts()' to re-overwrite to the default order( orderby=date, order=DESC ), You need to use own custom parameter 'orderby=default_date'.
62
+
63
+ `
64
+ <?php $query = get_posts( array(
65
+ 'orderby' => 'default_date',
66
  'order' => 'DESC',
67
  ) ) ?>
68
  `
93
  'orderby' => 'rand'
94
  ) ); ?>
95
  `
96
+ = How to move post of second page in top of first page. =
97
+
98
+ Go to "screen options" and change "Number of items per page:".
99
 
100
  == Changelog ==
101
 
102
+ = 3.0.8 =
103
+
104
+ * Even for 'get_posts()', Your custom Query which uses the 'order' or 'orderby' parameters is preferred.
105
+ ATTENTION: Only if you use 'get_posts()' to re-overwrite to the default order( orderby=date, order=DESC ), You need to use own custom parameter 'orderby=default_date'.
106
+
107
  = 3.0.7 =
108
 
109
  * This plugin will imported listed above into the translate.wordpress.org translation system. Language packs will also be enabled for this plugin, for any locales that are fully translated (at 100%).
120
 
121
  = 3.0.4 =
122
 
123
+ * Your custom Query which uses the 'order' or 'orderby' parameters is preferred.
124
  In order to prefer the parameters of your query, You must use the 'WP_Query()' or 'query_posts()'.
125
  Excluded 'get_posts()'.
126
  * Fixed bug