Web Development Blog

by Ei Sabai Nyo

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.
Your name:   Your email:  

5 Responses to “A list of all posts in an alphabetical order”

  1. JHS says:

    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!

  2. Really helpful, thanks man!! was looking all over the net for this one.

  3. ET says:

    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.

  4. Stectnoge says:

    Is social media going to kill SEO?

  5. mahen says:

    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

Profile PicHello! 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 about me or have a look at some of the tips & resources I've written.
Subscribe to our newsletter to receive tips, resources and special offers related to web development & design.
We do NOT spam.
Your name:  
Your email:  

Tips & Resources

Tips & Resources
WordPress Web Hosting
Recommended web hosting providers for WordPress 3.0
iPhone Native App Development
Important steps into iPhone app development for beginners
iPhone Web App Development
Tips for iPhone web app development
Coupons for Web Developers
Get discounts on web hosting, domain names, templates, etc
10 Useful jQuery Snippets
Easy-to-use jQuery snippets for any website
HTML Email Newsletter
Step-by-step tutorial on how to code an HTML email newsletter
  • bluehost Hosting $6.95/month
  • Joomla Templates

Recommended Book

Categories

Free spins is a well known feature of Australian pokies and one of the reasons

casino Try the House of Dragon pokie


Casino Bellini Online offers a huge welcome bonus, 300+ games, and a secure bästa online casino - Visit Pokie Wins to find free online casino chips.
Learn more about Online Pokies, which are Online Slot Machines.
Online Roulette 30 Jan 2013.
games from baccarat to blackjack and play for fun or real money. Online Blackjack Play the Karate Pig pokie game for free in demo mode.
Canada. internet casino Review of Gladiator Pokies - Get ready to rumble Roman Empire style with the