For a piece of software with its roots firmly in the world of online writing, WordPress users are often surprised by the absence of what seem like obvious bits of blogging functionality. A classic case in point is the lack of easy default ways to re-order your blog posts.
In this piece, we’ll step through two options available to you for solving this problem, pointing you to relevant links and plugins along the way. However, before we get into all of that, let’s start with a bit of background on how post sorting actually works in WordPress.
How WordPress Handles Default Post Order
The story of how WordPress handles default post order is not a particularly long and complicated one – the simple summary is that it does it by post date. Let’s say, for our own mysterious purposes, we’ve decided to turn A Tale of Two Cities by Charles Dickens into a series of blog posts. As you can see below, we’ve got the option of sorting by both title and post date in the back end:
Unfortunately, even this basic functionality is denied to us on the front end. Here, posts are simply listed chronologically by default, with no options to filter or adjust them:
While this may be a thrilling nod to Dickens’ trailblazing adoption of serialization back in the day, it’s actually a bit of a UX disaster. If we’re trying to encourage people to read a linear narrative, it’s a bit much to ask them to start at the bottom and read up.
Poking around inside default WordPress options, we’re basically presented with two choices at this stage:
- Use sticky post functionality.
- Start retrospectively changing post dates to force the order we want.
The first option is woefully inadequate in terms of the control needed. The second quickly becomes hard to manage when we’re dealing with large pools of content. It’s also potentially a complete non-starter for sites where the date is a critical component of individual pieces – news sites, for example.
So, long story short – the baked in options to re-order your blog posts are lacking. However, as with most things WordPress, a solution is at hand – two of them in fact.
How to Re-Order Your Blog Posts (with 2 Methods)
One of the great things about WordPress is its flexibility. With that in mind, we’ve offered two solutions to re-order your blog posts – both manual and plugin options. Let’s step through them in turn.
Option 1: Roll Your Own Ordering Solution
One of the many plus points of using WordPress as a blogging or business solution is that if things aren’t quite to your liking, you’ve always got the option of stepping in and changing them around yourself.
This doesn’t have to be a dauntingly technical undertaking either. Before we get cracking, back up your site and bone up on your File Transfer Protocol (FTP) knowledge if necessary. Once you’re ready, come back!
Firstly, let’s have a quick look at a proof of concept change. Once you’ve logged into your FTP client, navigate to the functions.php file in your /wp-content/themes/your-theme folder. Here, we’ve added a simple function just to check if control over post order is possible:
function change_query_order( $query ) { if ( $query-is_home() && $query-is_main_query() ) { $query-set( 'orderby', 'title' ); $query-set( 'order', 'ASC' ); } } add_action( 'pre_get_posts', 'change_query_order' );
Once you’ve saved the file and checked our website, we should be looking at our posts sorted in ascending alphabetical order once we refresh the page:
However, kludging together quick and dirty functions at the end of functions.php is a little old-school. Really, this type of business should be taken care of in a custom plugin.
With that in mind, this tutorial is an excellent breakdown of exactly how to go about achieving it. It also includes working code nicely packaged up at GitHub. This series is also well worth a look if you’re thinking of rolling up your sleeves and diving into the code yourself.
Option 2: Use the Post Types Order Plugin
This being WordPress, there are of course also existing plugins that tackle this problem of post order. The one we’ll look at is the Post Types Order plugin:
While it offers the functionality we require, in addition it’s regularly updated, boasts an impressive 400,000+ active installs, and has rock-solid ratings from a host of satisfied users. There’s also a more full-featured premium version of the plugin available – in the shape of the Advanced Post Types Order plugin – for just $35.
Installation is a snap, but you’ll be prompted to pop into the plugin’s settings page after activating:
The basic options you see after clicking through are pretty straightforward, with several useful links offering code samples for places where you may need to step in:
Although the options may look overwhelming, using the plugin is incredibly simple and works exactly as you’d expect. Once activated, navigate to Posts > All Posts, and you’re free to pick up individual items and rearrange them in the order you want. Below, we’re busy getting that Dickens order the way we want it:
Changes will then automatically be picked up on the front end. For more of a feel for just how easy this is once the plugin is installed, check out the demo video below. It’s from an older version of the plugin, but it gets the basic point across nicely:
Conclusion
Because WordPress is so flexible, post sorting feels like the kind of functionality that should arrive out of the box, with substantially better default options to hand. Sadly, that’s not the case. However, we do have manual and third-party options at our disposal for getting things arranged how we want.
In this post, we’ve shown you two methods to re-order your blog posts. Let’s recap:
- Create your own custom code: If you’re comfortable with ‘rolling your own’, just a few lines of code is probably all that’s required to help arrange things to your pleasing.
- Use an existing plugin: In our tests, the Post Types Order plugin stood out for its simplicity and ease of use. Having the option of upgrading to a commercial version for more in-depth sorting options is also reassuring.
Do you have any questions on how to re-order your blog posts? Get in touch via the comments section below, and make sure you subscribe to the conversation!
Article thumbnail image: HeydarovTabriz / shutterstock.com.
How can I have different sorting of posts on different pages?
I have different categories of blog posts. I want each category sorted differently. One page is of events, and I want to show just the events posts sorted by date. On another page, I have just speakers, and I want to list the speakers just sorted alphabetically.
I too am still looking for a way to do this. I need alphabetically on some pages but to keep as chronologically on others.
The code you provide in this post is wrong in syntax ( use -> insted of – )
I’ve installed Post Types Order and activated it. But I don’t know where the setting is for ASC vs DESC; please give me a pointer. Although I’m quite familiar with PHP, I don’t want to take that approach when there’s a way to just specify the order I need. (My whole reason to use WordPress is to get away from doing custom coded websites to create great websites.)
This plugin is much appreciate because without reversing the built-in order, the blog is useless for my purpose.
Thank you soooo much. In the past I had tried some other plugins but the those never seemed to work for me. So, I gave up on being able to re-order posts.
And, forget about php coding. No way… that would spell big trouble. LOL
The difficulty I was running into (with the other plugs) was that the posts would re-order on the “blog” page, but not in the widget area where they were also displaying – and my need was particularly for the widget area to be re-ordered.
This plugin works like a charm!
Thank you again.
Hi John,
Thanks for this great, informative and useful article. I am using ‘Post types order plugin’ this is amazing and lightweight plugin but this is not working properly for me.
Please tell me how do I use this plugin?
Thanks in advance!
Regards,
~ Vijay Kumar
Hello Vijay,
Without specific information as to what problem you are experiencing, I’m afraid I can’t help.
Cheers,
John
GREAT! Just the functionality that I have been looking for. The $64,000 Question is: will it work for posts displayed using the Divi Blog Module?
I had to ask for help form the developer on the $35 premium mode to re-order my posts. But I am not very adept at these things.. They obliged quickly.