WordPress: how to display posts in alphabetical order?
Helou, ever thought how to display posts in alphabetical order with WordPress? Yes, by default, WordPress displays posts in descending and chronological order. Well, there are different WordPress methods to list posts in alphabetical order.
Configuring The Loop!
I assume you are aware of that you can set your own settings to the WordPress Loop and list the posts the way you want. Simpliest solution to the alphabetical order is that you set the argument “orderby” to “title”. But, what do you do for example if you want to list all posts alphabetically from specific category (eg. “books”) in descending order (newest first)? Let’s make that happen!
$args = array( 'category_name' => 'books' // category "books" 'orderby' => 'title', // alphabetical order 'posts_per_page' => '-1', // gets all posts 'order' => 'DESC' ); $query = new WP_Query( $args );
There you go. The loop will display all posts from category called “books” in descending order.