WordPress Icon Logo
me@grafxflow

Written by me@grafxflow

18 Mar, 2013

0

2,988

Order posts alphabetically in WordPress

By default WordPress orders your posts by the edit/added date. But what happens if you want them to be ordered Alphabetically.

Open the following files:

  1. tag.php
  2. category.php
  3. search.php

And find where it says in each file...

<?php if ( have_posts() ) : ?>

Now add the following line above it so it looks like below.

<?php query_posts($query_string . '&orderby=title&order=ASC'); ?>

<?php if ( have_posts() ) : ?>

If you want to order the posts by another value other than Alphabetical then here are the references parameters for WordPress.

WP_Query Reference - Orderby Parameters

Add comment

Smart Search

133 Following
50 Followers

me@grafxflow

Hull, United Kingdom

I am a Full-stack Developer who also started delving into the world of UX/UI Design a few years back. I blog and tweet to hopefully share a little bit of knowledge that can help others around the web. Thanks for stopping by!

Follow