Skip to Content

4 Great Ways to Reorder Posts in WordPress

4 Great Ways to Reorder Posts in WordPress

By default, the blog page on WordPress uses reverse-chronological order to show your newest content first. What happens when you do not want that?

Surprisingly, it does not take long to learn how to reorder posts in WordPress.

One line of PHP code pasted into your theme’s functions.php file switches the order posts are displayed.

Alternatively, apply ‘orderby’ parameters. WordPress has a Rolodex of these. The most useful are listed below.

There are also various plugins that do the code edits for you.

However you want the order of your content to be displayed on WordPress, you will find the methods and instructions below to make it a breeze.
 

How to reorder posts in WordPress

WP posts can be reordered by changing the date, making the post sticky, or editing the functions.php file. Plugins that work are Chronological Posts, Posts Type Order, and Simple Custom Post Order. The WooCommerce Extra Product Sorting Options plugin adds reordering options to WooCommerce stores.
 

1. Reorder posts by changing the date

By far, the simplest way to reorder posts on WP is to use the ‘quick edit’ function to change the date. This is because the default display for posts is to show the most recent first.

Use this method when you want to show a few posts specifically.
 

2. Reorder posts by using the sticky posts feature

Using sticky posts is like pinning the post to the top of your blog homepage.

Within your editor, go to the “Publish” widget on your right sidebar and check the box that reads “Stick this post to the front page”.

There is also a check box in the quick edit menu to “Make this post sticky”. This does the same thing. 

You can make as many posts “sticky” as you like. The order they appear on your homepage though will be based on the date published.

For more than one sticky post, you may want to alter the publication date using the quick edit described previously, remembering that the most recently published shows first.

Unless you…
 

3. Edit the Functions.PHP file

By default, WordPress posts are shown in descending order of the most recently published posts. This is controlled by the WordPress core framework.

On a sidenote: You can obviously always manually change the Publish date of WordPress posts if required.

In PHP, the default query string for the post order is:

$query->set( 'order', 'DESC' );

The ‘order’ can be changed to show posts in ascending order (‘ASC’), which will show the oldest posts first.

Go to your “appearance” menu on the left sidebar, select “theme editor”.

Locate the functions.php file for the template you want to edit, then paste the PHP scripts at the end of the file.

Add this code to the functions.php file for your theme…

function wpb_custom_query( $query ) {
if( $query->is_main_query() && ! is_admin() && $query->is_home() ) {
$query->set( 'orderby', 'date' );
$query->set( 'order', 'ASC' );
}
}
add_action( 'pre_get_posts', 'wpb_custom_query' );

To change to any other order, the code above can be modified by removing the ‘order’ string and setting an ‘orderby’ parameter.

Like this…

function wpb_custom_query( $query ) {
if( $query->is_main_query() && ! is_admin() && $query->is_home() ) {
$query->set( 'orderby', 'rand' );
}
}
add_action( 'pre_get_posts', 'wpb_custom_query' );

In the above code, you can replace the ‘orderby’ parameter (‘rand’ in the above code) with any parameter set in the WP_Query class for orderby parameters.


 
Some of the most useful are:

‘Author’ – displays posts in order of the author ID.
‘Title’ – Displays posts in alphabetical order.
‘Modified’ will display recently modified posts first.
‘Parent’ will use the post ids and hierarchy of your content to show the parent post first, then the child posts under it. This is handy for a series of related posts. This concept also exists for pages. So there, you can have Parent pages and Child pages respectively.
‘Rand’ will show random posts with no logical order.
‘Comment_count’ will show your most commented content.

If you would rather not tinker with PHP code edits…
 

4. Use WordPress plugins to change the order of posts

As with most things on WordPress, when something can be changed by modifying the PHP scripts, a developer will release a plugin to help non-advanced users use the advanced functions without needing to work with code.
 

Listed here are some of the best reordering plugins for WordPress

 

Chronological Posts Plugin

The Chronological Posts plugin switches the default reverse-chronological order of posts from “DESC” to “ASC”.

Go to Plugins > select Add New, and search by keyword for “Chronological Posts” 

Click install and then activate.

Your blog posts will now be listed in order from oldest to newest.
 

Posts Type Order Plugin

The Posts Type Order plugin lets you drag and drop your posts within the WP admin panel to change the order on the blog page.

Go to Plugins > select Add New, and search by keyword for “Posts Type Order”. 

Click install then activate. When you go back to your “all posts” view, you will be able to drag your posts into the order you want them to show.


 

Simple Custom Post Order plugin

This plugin is a more advanced version of the Posts Type Order plugin. It gives you the options to reorder custom post types, pages, including category pages, and link categories.

Essentially, what it is doing is applying the correct “orderby” parameters to your functions.php file.

If you want to use the WP_custom_query class but get squeamish around PHP codes, this plugin is the solution.

Go to Plugins > select Add New, and search by keyword for “Simple Custom Post Order”. 

Click install and then activate.

Point and click to configure the settings, then drag and drop any page or post type into the order you want.
 

WooCommerce Extra Product Sorting Options Plugin

For those running a store on WordPress using WooCommerce, the default sorting options are limited.

Sort products by popularity, average rating, latest products, or in order of price ascending or descending.

With the WooCommerce Extra Product Sorting Options plugin, you can rename the fields, and reorder your products in more ways.

Go to Plugins > select Add New, and search by keyword for “WooCommerce Extra Product Sorting Options”.

Click install then activate. Locate the plugin on your “installed plugins” page, then click configure.

From these settings, you can reorder and rename your products, such as showing your sale items first and letting customers choose to reorder products to their custom view, such as sort by most reviewed.

For renaming sorting options, you may want to consider tweaking the names, such as renaming “default sorting” to be “Our Best Picks” for the items you want to increase sales of, and “our customer favorites” to reorder your products to show the highest rated reviews.

In order to make sure that your posts & articles & products actually show in the desired order, you might also want to have a look at our article on “How to Change the Time Zone in WordPress.