WordPress Alphabetical Index: Create An A-Z Listing Of Any Content

Let me guess: You’ve been searching for a WordPress A-Z plugin but none of them do exactly what you want them to do. Now, you need to create an alphabetical listing of your WordPress content but maybe you’re not sure how to get started.

Don’t worry – we’ve got you covered.

In this post, I’ll show you how to create a WordPress alphabetical index from any type of content on your site – posts, pages, custom post types… you name it! You can use this to create A-Z listings, with posts listed by letter. Or maybe a WordPress glossary, where people can click on the A-Z letters or numbers to view the listings under each one.

Example of WordPress A-Z listing for movies

Let’s get started so you can have a working solution to your problem as soon as possible!

How to create a WordPress alphabetical index or list

To demonstrate how to create a WordPress alphabetical index, I’m going to use a real-life example of creating an A-Z movie index where visitors can click on any letter to jump straight to movies with names that start with that letter.

You can see an example of the end result below:

final wordpress a-z listing of movies

The process that I show you can work for anything, though, so you’ll be able to adapt this same basic approach to anything from regular WordPress posts to custom post types and even WooCommerce products.

Posts Table Pro – the perfect WordPress A-Z plugin

While there are some simple WordPress A-Z plugins, most of them force you into using a single preset layout and only apply to regular WordPress posts.

On the other hand, by using Posts Table Pro, you’ll be able to:

  • Create an A-Z index for regular posts, pages, or custom post types
  • Manipulate your WordPress alphabetical index to show only the exact information that you want
  • Include data from custom fields in your index

You can see a live example of the types of indexes that Posts Table Pro can help you create at this demo page.

Here’s everything you need to create your WordPress alphabetical index

And if your theme doesn’t already have functionality for tabs or toggles, you’ll also need:

  • Shortcodes Ultimate plugin (free), optional, but makes it easy to create clickable tabs to divide your index by the letters in the alphabet.

Buy Posts Table Pro

The entire process in a nutshell

I’m going to break down every single step in more detail. But before I do that, I want to give you a high-level look at the process so that you have an idea where this article is going.

To create a WordPress alphabetical list you’ll:

  1. Decide between listing regular posts, pages, or using a custom post type
  2. Create a custom taxonomy that you’ll automatically add the first letter of the post to using a code snippet (for easy alphabetization) – or you can set the letters manually if you don’t want to edit any code
  3. Create a list of content for each letter using the Posts Table Pro shortcode
  4. Display those lists in a tabbed-interface using Shortcodes Ultimate (or something similar)

Let’s get started!

Step 1: Decide what content you want to index

Posts Table Pro lets you index content from:

  • Posts
  • Pages
  • Custom post types

So if you haven’t already, it helps to think of the best way to store the content that you want to index.

  • Posts – typically, people use the default posts to store blog posts. So if you want to create an alphabetical index of your blog posts, this is what you want.
  • Pages – pages are generally more for static content. You can create an index of your pages, but for more specialized content, you’ll probably want a custom post type instead.
  • Custom Post Type – custom post types are flexible and good for storing non-standard content, like a movie entry, staff member, and more.

For this demo, I’m going to use a custom post type to store the movie entries. But if you want to use regular posts, instead, it’s as simple as removing one tiny little phrase later on the article (I’ll explain this when we get there!).

Step 2: Create custom post type using Pods

If you’re going to use regular WordPress posts instead of a custom post type, you can click here to skip straight to the next step.

To create your custom post type, install and activate the free Pods plugin. Then:

  • Go to Pods Admin → Add New in your WordPress dashboard
  • Click on Create New to create a new content type

how to create a new custom post type

Then, make sure the Content Type is set to Custom Post Type, give it a singular and plural label, and click Next Step.

For this example, that will be “Movie” and “Movies”. But again, you can adapt this to anything – “Staff Member”, “Artist”, “Document” – you name it!

enter custom post type details

That’s it for now! You should see your new custom post type show up in the WordPress sidebar.

I’ll cover some neat enhancements – like adding custom fields – later on. But for now, you’re ready to move on to the next step.

Further reading: Pods: An Easy Way to Create WordPress Custom Post Types, Custom Fields & Taxonomies

Step 3: Create a custom taxonomy

In order to index content alphabetically, you need to create a taxonomy for Posts Table Pro to filter content based on.

Essentially, you create the Alphabetical Letter taxonomy and assign each post a taxonomy for the first letter in the post’s title (don’t worry – I’ll show you a way to do this programmatically so that you don’t need to manually set the taxonomy for every content item).

For my movie example:

  • “Eat Pray Love” would get “E”
  • “Conspiracy Theory” would get “C”
  • Etc.

Here’s how to create the necessary taxonomy:

If you skipped here from Step 1, you’ll need to install and activate the Pods plugin before you continue.

  • Go to Pods Admin → Add New in your WordPress dashboard
  • Click on Create New to create a new content type

how to create a new custom post type

Then, select Custom Taxonomy from the drop-down and enter “Alphabetical Letter” and “Alphabetical Letters” for the labels (the actual name isn’t especially important – just make it easy to remember). Then, click Next Step:

how to create a custom taxonomy

You should now be in the Edit Pod interface.

Go to the Advanced Options tab and:

  • Uncheck the Hierarchical box (because we’re only going to use the 26 letters of the alphabet, there’s no hierarchy involved)
  • Choose the relevant Associated Post Types

For my example, I want to associate the taxonomy with the Movies post type. But if you want to use regular WordPress posts instead, you would associate it with the Posts type:

associate taxonomy with post type

After making those changes, make sure to click Save Pod.

Step 4: Add content using the proper taxonomy

Now, if you go to add new content using regular posts or your chosen custom post type, you should see the new Alphabetical Letters taxonomy.

Add your content, making sure to add the appropriate letter to the Alphabetical Letters taxonomy for each piece of content.

add custom taxonomy to create a wordpress alphabetical index

How to add the taxonomy programmatically

For small amounts of content, it’s fine to add the taxonomy manually. But if you’re dealing with large amounts of content, you might prefer a method that doesn’t require you to manually input the taxonomy every single time.

Thankfully, you can do that using some basic code. Essentially, this code snippet will automatically chop off the first letter of any piece of content and add it as a taxonomy – no manual input required!

While you’ll need a tiny bit of PHP knowledge to get this done, it’s nothing too complex. Here’s the code I used for my example (credit to Kathy Is Awesome for this snippet):

Note – assisting with code snippets is outside of our plugin support. If you’re not comfortable editing code yourself, we recommend using Codeable to find a developer who can do this for you.

/* When the post is saved, saves our custom data */
function kia_save_first_letter( $post_id ) {
 // verify if this is an auto save routine.
 // If it is our form has not been submitted, so we dont want to do anything
 if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
 return $post_id;

//check location (only run for posts)
 $limitPostTypes = array('post');
 if (!in_array($_POST['post_type'], $limitPostTypes)) 
 return $post_id;

// Check permissions
 if ( !current_user_can( 'edit_post', $post_id ) )
 return $post_id;

// OK, we're authenticated: we need to find and save the data
 $taxonomy = 'glossary';

//set term as first letter of post title, lower case
 wp_set_post_terms( $post_id, strtolower(substr($_POST['post_title'], 0, 1)), $taxonomy );

//delete the transient that is storing the alphabet letters
 delete_transient( 'kia_archive_alphabet');
}
add_action( 'save_post', 'kia_save_first_letter' );

To make this code your own, you need to:

  • Replace post in array('post'); with the name of your custom post type (only if you’re using a custom post type).
  • Replace glossary in  $taxonomy = 'glossary'; with the name of your actual taxonomy

To find the name of your taxonomy and/or custom post type, click on Pods Admin and look at the Name column:

how to find taxonomy name

You can then add this code to your site using a plugin like Code Snippets (I marked the two areas that you need to modify with arrows to make things clear):

where to replace code snippets

Once you add the code, you’ll no longer need to manually edit the taxonomy for each piece of content. Instead, WordPress will automatically take the first letter of the post and add it to the taxonomy whenever you publish or update the piece of content.

You can see this in action below:

Step 5: Generate Posts Table Pro shortcode

Now, you’re ready to create the various alphabetical lists of your content. To do this, you’ll use the Posts Table Pro plugin shortcode.

To build the shortcode, you’ll do four things:

  1. Choose which type of content you want to display – either regular posts or your custom post type
  2. Choose which columns you want to display, which allows you to control what information shows up in your index (I’ll show you how to add custom fields to this later on)
  3. Filter the Alphabetical Letter taxonomy to return only posts that start with the relevant letter
  4. Sort each list to make it alphabetical within that letter (if needed)

The basic Posts Table Pro shortcode looks like this:

[posts_table]

To accomplish the steps above, you’ll need to add various shortcode parameters for each function.

Choose which type of content to display

By default, Posts Table Pro automatically displays regular WordPress posts. That means if you’re displaying regular posts alphabetically, you don’t need to do anything here. Skip to the next section!

If you’re displaying custom post types or pages, though, you’ll need to add the post_type parameter.

For example, to display content from the Movies post type in my example, you’d add the parameter like this:

[posts_table post_type="movie"]

The name of the post type is that same one that you used in the previous steps and can be found in the Edit Pods interface.

Choose which columns to display in your table

Now that you’ve selected what type of content to display, you need to choose the specific information that you want to display as columns in your table. For example, depending on what you’re displaying, you might want to show:

  • Post title
  • Custom fields
  • A link or buy button
  • Etc.

To do that, you use the columns shortcode parameter. For example, here’s how to create a basic table that displays just a post’s title:

[posts_table columns="title" post_type="movie"]

You can display additional columns by separating each column with a comma.

At the end of this article, I’ll give you an example for how you can show more information using custom fields that you add with Pods.

Filter posts to display them alphabetically and set sort order

The shortcode above will display every single post, which isn’t great for creating a WordPress alphabetical index!

To fix that, you can use the term shortcode parameter to only return posts that start with that letter:

term="<taxonomy slug>:<term slug or ID>"

The part before the colon is the actual name of your taxonomy, while the part that comes after is the letter you want to filter for.

For example, to filter out just posts that start with “a”, you would use this:

[posts_table columns="title" post_type="movie" term="alphabetical_letter:a"]

To filter out posts for each letter, you’ll use 26 different shortcodes, changing the letter in the term parameter each time.

If you want to include numbers 0-9 because your list might include some numeric options, you could also include a shortcode that targets all 10 numbers.

To make sure the list is alphabetical for each letter, you can further add the sort_by shortcode parameter to order things alphabetically. For example:

[posts_table columns="title" post_type="movie" term="alphabetical_letter:a" sort_by="title"]

Step 6: Create tabs using Shortcodes Ultimate plugin and insert shortcode

example of wordpress a-z listing tabs

If you want to create a set of clickable tabs like the example above, Shortcodes Ultimate provides an easy, theme-agnostic solution. With that being said, if your theme does include aready functionality for tabs/toggles, we recommend using that first. If not, go for Shortcodes Ultimate!

To get started:

  • Install and activate the free Shortcodes Ultimate plugin
  • Go to the WordPress editor for the page you want to add your WordPress alphabetical index to
  • Click on the new Insert shortcode button above the editor toolbar
  • Select the Tab option

how to use shortcodes ultimate

  • Enter “A” in the Title and Anchor

enter letter

  • Enter the Posts Table Pro shortcode in the Content box
  • Click Insert Shortcode
  • Repeat the process for each letter in the alphabet, making sure to change the letter in the Posts Table Pro shortcode each time to display the correct taxonomy term

Once you’ve added 26 shortcodes for all the letters in the alphabet (27 if you want to collectively include numbers 0-9 as a separate option), wrap the entire set of shortcodes in the [su_tabs] shortcode. You can see roughly what it looks like below:

wrap all the shortcodes

Enjoy your new WordPress alphabetical index

Now, if you Publish your page, you should be able to see your WordPress alphabetical index.

Here’s what my example looks like after adding a few more movies. I’ll use a GIF so that you can see how the alphabetization works:

example of wordpress alphabetical index

If you want to remove the search, filter, and/or pagination options, you can add additional shortcode parameters to further customize how things look and function.

And if you want to enhance your index with more information, here’s a neat way to display extra information using custom fields…

Enhancing your WordPress alphabetical index with custom fields

Because Posts Table Pro can display custom fields, you can use custom fields to display additional information as a separate column in your index.

For example, in my alphabetical movie list, it might be helpful to include extra information for things like:

  • Release Date
  • Director
  • Etc.

Here’s how to do it:

Step 1: Add custom fields using Pods

To add custom fields to a custom post type using Pods, just edit that custom post type from the Pods interface.

On the other hand, if you want to add custom fields to your regular WordPress posts, you’ll need to:

  • Go to Pods Admin → Add New
  • Choose the Extend Existing option
  • Select Post Types in the Content Type drop-down
  • Choose Posts in the Post Type drop-down

how to add custom fields

Once you’ve done that, you should see the same Edit Pod interface as if you were editing an existing custom post type.

To add a field, click the Add Field button and then configure the field type and other information:

extending regular posts

For example, here’s what it looks like after I’ve added fields for Director and Release Date:

example of custom fields

Once you save your changes, you’ll be able to add information directly to those fields if you go to the relevant post type:

adding custom fields

Step 2: Include custom fields as columns in Posts Table Pro shortcode

Now that you have your custom fields, all that’s left to do is include them in the columns shortcode parameter in your Posts Table Pro shortcode. To do that, add a comma between each column you want to display.

To add custom fields, you use this format:

cf:<field name>

You can find the field name in the Edit Pod interface:

custom field names

So to add columns for Director and Release Date to my example from before, I would use this shortcode:

[posts_table columns="title,cf:director,cf:release_date" post_type="movie" term="alphabetical_letter:e"]

Put it all together, and my example alphabetical movie index looks like this:

final wordpress a-z listing of movies

You may also like: How to use a WordPress index plugin to list pages, posts or any custom post type.

Creating An Alphabetical Index Of WooCommerce Products

All the steps that I’ve shown you in this article can be easily adapted to create a WordPress alphabetical index of WooCommerce products using our WooCommerce Product Table plugin.

Essentially, you’ll perform identical steps to everything I’ve discussed above but focusing on the product post type that WooCommerce creates.

Here’s a quick summary of the steps that you’ll want to take:

  • Use Pods to create a new Alphabetical Letter custom taxonomy that is associated with the Products post type
  • Take the same code snippet from Step 4 and apply it on the product post type to programmatically add the product’s first letter to the Alphabetical Letter taxonomy that you created
  • Use the WooCommerce Product Table shortcode to filter products by taxonomy and control what information is displayed
  • Add the WooCommerce Product Table shortcode to tabs that you create with Shortcodes Ultimate

The advantage of using WooCommerce Product Table is that you’ll be able to easily include product images, Buy buttons, and other eCommerce-focused information in your alphabetical product table.

Posts Table Pro is your flexible WordPress A-Z plugin

If you want to create a flexible WordPress alphabetical index, Posts Table Pro gives you all the functionality that you need.

You’ll be able to organize any type of content, including custom post types. And you’ll also be able to manipulate your content’s front-end display by choosing exactly what shows up in the index, including custom fields.

Remember – to create the alphabetical list like the example above, all you need is:

  • Posts Table Pro (or WooCommerce Product Table if you want to create an alphabetical list of WooCommerce products)
  • Pods to create the custom taxonomy and/or custom post type
  • Shortcodes Ultimate to display everything in a tabbed A-Z list (or your theme’s built-in options)

Have any further questions about how to create a WordPress alphabetical index? Leave us a comment and we’ll try to help out!

Buy Posts Table Pro