02 Feb, 2009
A list of all posts in an alphabetical order
It is not uncommon for a WordPress blog to display a list of all posts in an alphabetical order. I was using <?php wp_get_archives('type=postbypost');?> to display all posts by post title but I couldn’t find a way to sort the post titles in an alphabetical order. After looking at the source code (general-templates.php), I noticed that WordPress already has a built-in functionality that does that. All you need to do is replace postbypost with alpha and it will displays all posts in an alphabetical order of the post title. Not sure why it isn’t mentioned in wp get archives Template Tags page.
Usage demo:
in sidebar.php
<div id="archive">
<h2 class="title">Archive</h2>
<div>
<ul>
<?php wp_get_archives('type=alpha');?>
</ul>
</div>
</div>
Love what you've just read? Subscribe to our newsletter to receive tips, resources and special offers related to web development & design.
Other similar posts that you might be interested in:
- 5 steps to creating a custom Archive page in WordPress
- Display 5 latest posts in each category in WordPress
- Customising category.php in WordPress
- Display 10 recent post titles on homepage
- How to add a breadcrumb to your blog and have it appear on Google’s Search Result Snippet
- WordPress iPhone App – a step by step user guide to using WordPress for iPhone
- 7 Link Challenge for Web Development Blog
Hello! Welcome to Web development blog! My name is Ei Sabai and on this blog, I write about web development, mobile app development, latest web technologies and the likes. Read more 


Wow, I’ve been trying to figure out how to do this within my Sitemap. I had no idea it was so simple! This was very helpful. Thanks!
Really helpful, thanks man!! was looking all over the net for this one.
THANK YOU!!!
I don’t know why I couldn’t find this on the WordPress site. I just spent a ridiculous amount of time, and you rescued me from a meltdown.
Is social media going to kill SEO?
I was using azindex plugin to index my posts in alphabetical order and create a TOC like page, bu suddenly it stopped working, can anyone help me out with anyother method which i can understand, i know nothing about coding