Skip to content

Commit fd159e3

Browse files
committed
v3.0.8
1 parent 9b4a2bd commit fd159e3

File tree

3 files changed

+36
-10
lines changed

3 files changed

+36
-10
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ Intuitively, order items( Posts, Pages, and Custom Post Types, and Custom Taxono
88

99
Select sortable items from 'Intuitive CPT' menu of Setting menu in WordPress.
1010

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.
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`.
1313

1414
## Installation
1515

intuitive-custom-post-order.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Plugin Name: Intuitive Custom Post Order
44
* Plugin URI: http://hijiriworld.com/web/plugins/intuitive-custom-post-order/
55
* 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
6+
* Version: 3.0.8
77
* Author: hijiri
88
* Author URI: http://hijiriworld.com/web/
99
* Text Domain: intuitive-custom-post-order
@@ -459,8 +459,12 @@ function hicpo_pre_get_posts( $wp_query )
459459

460460
// get_posts()
461461
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' );
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+
}
464468
// WP_Query( contain main_query )
465469
} else {
466470
if ( !$wp_query->get( 'orderby' ) ) $wp_query->set( 'orderby', 'menu_order' );

readme.txt

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Contributors: hijiri
33
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=TT5NP352P6MCU
44
Tags: post order, posts order, order post, order posts, custom post type order, custom taxonomy order
55
Requires at least: 3.5.0
6-
Tested up to: 4.3.1
6+
Tested up to: 4.7.3
77
Stable tag: 3.0.7
88
License: GPLv2 or later
99
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
1616

1717
Select sortable items from 'Intuitive CPT' menu of Setting menu in WordPress.
1818

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.
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'.
2121

2222
This Plugin published on <a href="https://github.com/hijiriworld/intuitive-custom-post-order">GitHub.</a>
2323

@@ -45,7 +45,24 @@ By using the 'WP_Query', you can re-override the parameters.
4545

4646
`
4747
<?php $query = new WP_Query( array(
48-
'orderby' => 'date',
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',
4966
'order' => 'DESC',
5067
) ) ?>
5168
`
@@ -82,6 +99,11 @@ Go to "screen options" and change "Number of items per page:".
8299

83100
== Changelog ==
84101

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+
85107
= 3.0.7 =
86108

87109
* 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%).
@@ -98,7 +120,7 @@ Go to "screen options" and change "Number of items per page:".
98120

99121
= 3.0.4 =
100122

101-
* Your Query which uses the 'order' or 'orderby' parameters is preferred.
123+
* Your custom Query which uses the 'order' or 'orderby' parameters is preferred.
102124
In order to prefer the parameters of your query, You must use the 'WP_Query()' or 'query_posts()'.
103125
Excluded 'get_posts()'.
104126
* Fixed bug

0 commit comments

Comments
 (0)