WordPress is the most popular blogging platform for bloggers. This post will show you how to change the order of posts and pages in WordPress themes. Here are a few ways you can customize the sorting order of your posts in WordPress.
Customize WordPress Post Order Manually
Open your theme and enter the following code to customize the post order manually:
// display posts organized by title in ascending order
This code will display a specified number of posts, in ascending order according to the post title. This code can be customized in many ways to suit your needs.
Another useful trick is to customize the order of categories, such as in an archive directory or service directory. Replace the first line in the loop example above with the following:
<?php if (is_category()) { $posts = query_posts( $query_string . '&orderby=title&order=asc' ); } ?>
You can also add another endif
to the loop as follows:
<?php endif; ?>
<?php endif; ?>
You can also replace is_category()
with the is_whatever()
statements of your choice.
is_home()
is_single()
is_author()
is_search()
is_archive()
For more information, visit the WordPress Codex.
Plugins to customize post order automatically
We’ll look at some simpler custom sorting methods using WordPress plugins.
1. Custom Query string Reloaded for WordPress
Custom Query Reloaded is a popular WordPress plugin. CQS (Custom Query String) offers an Admin Options Panel where users can specify as many custom post queries as they wish. CQS allows for custom sorting.
2. Smart Sort WordPress Plugin: Sort posts by Custom Field
This plugin lets you place a sorting bar with the option to sort posts based on any custom field. The sort bar can be placed above or below the list of posts within a category, archive or anywhere else in your template.
3. aStickyPostOrderER – Plugin to Change the WordPress Post Order
This plugin can help you reorder the posts that WordPress displays.
aStickyPostOrderER allows you to customize the order in which posts appear on a WordPress blog, based on categories or tags. This is useful for WordPress to be used as a Content Management System. ).
4. WP-Snap! WordPress Plugin
WP-SNAP! WordPress Plugin that creates alphabetical listing ABCDEF etc. Links on a template file. Clicking “A”, “D”, and “Z” will display all post titles beginning with the letter you selected.
5. Sort category posts by title
This plugin appears to be a simple and quick way to sort category posts alphabetically in ascending order based on the post title. The plugin’s home page states that “WordPress sort category posts by title” was created for WordPress 2.0.2. It only changes the order of the posts in category view. This will not affect the ordering of the posts on other pages (e.g. the homepage) of the site. This plugin’s code is clean and simple. It just begs to be explored and adapted.