WordPress.org

Plugin Directory

Test out the new Plugin Directory and let us know what you think.

Intuitive Custom Post Order

Intuitively, order items( Posts, Pages, and Custom Post Types, and Custom Taxonomies ) using a drag and drop sortable JavaScript.

How to re-override the parameters of 'orderby' and 'order'

Sub query

By using the 'WP_Query', you can re-override the parameters.

  • WP_Query
<?php $query = new WP_Query( array(
    'orderby' => 'ID',
    'order' => 'DESC',
) ) ?>
  • get_posts()
<?php $query = get_posts( array(
    'orderby' => 'title',
) ) ?>

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

<?php $query = get_posts( array(
    'orderby' => 'default_date',
    'order' => 'DESC',
) ) ?>

Main query

By using the 'pre_get_posts' action hook or 'query_posts()', you can re-override the parameters.

  • pre_get_posts
function my_filter( $query )
{
    if ( is_admin() || !$query->is_main_query() ) return;
    if ( is_home() ) {
        $query->set( 'orderby', 'date' );
        $query->set( 'order', 'DESC' );
        return;
    }
}
add_action( 'pre_get_posts', 'my_filter' );
  • query_posts()
<?php query_posts( array(
    'orderby' => 'rand'
) ); ?>

How to move post of second page in top of first page.

Go to "screen options" and change "Number of items per page:".

Requires: 3.5.0 or higher
Compatible up to: 4.7.3
Last Updated: 3 days ago
Active Installs: 100,000+

Ratings

4.4 out of 5 stars

Support

0 of 4 support threads in the last two months have been marked resolved.

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 people say it works.
0 people say it's broken.

100,1,1
100,1,1
100,1,1 0,1,0
0,1,0 75,8,6 75,4,3
100,2,2 100,1,1 100,1,1
100,3,3
100,2,2
100,2,2
0,1,0 50,2,1
0,2,0 67,3,2
50,2,1
100,3,3
100,5,5
67,3,2 100,1,1 100,1,1
100,1,1 100,1,1 100,2,2
100,6,6
100,1,1
0,1,0
100,1,1 60,5,3 0,2,0
100,1,1
67,3,2
50,2,1
50,2,1
100,1,1
67,3,2
0,1,0
100,2,2
100,1,1