Show your posts, pages, and terms alphabetically in a Rolodex-, catalogue-, or directory-style list with the A-Z Listing plugin!
The plugin has a short-code for the list, and a widget so you can link to the list from anywhere on your site. If a letter doesn’t have any pages then the widget will display the letter unlinked. The list page will omit the display for that letter entirely.
Show posts from any or multiple post types including the in-built posts and pages. Also supported are post-types from plugins like WooCommerce products. Alternatively, show terms like categories or tags.
Version 4.0.0 introduces new block editor support. You should use the block in most cases, as it helps to guide you through configuring the various options.
The plugin supplies a short-code for the full A-Z listing allowing use without modifying your theme’s templates.
Basic usage is as follows:
[a-z-listing]
To specify a post-type to display instead of page
then use, e.g. post
:
[a-z-listing display="posts" post-type="post"]
To filter the posts by a term from a taxonomy:
[a-z-listing display="posts" post-type="post" taxonomy="category" terms="my-term-slug"]
To display pages that are direct children of the page with ID 24
:
[a-z-listing display="posts" post-type="page" parent-post="24"]
To display pages that are children of any depth below the page with ID 24
:
[a-z-listing display="posts" post-type="page" parent-post="24" get-all-children="yes"]
To show terms from a taxonomy instead of posts and pages, e.g. Terms from the Categories
taxonomy:
[a-z-listing display="terms" taxonomy="category"]
To show terms from the Categories
taxonomy that are direct children of the term with ID of 42
:
[a-z-listing display="terms" taxonomy="category" parent-term="42"]
To show terms from the Categories
taxonomy that are children of any depth in the tree below the term with ID of 42
:
[a-z-listing display="terms" taxonomy="category" parent-term="42" get-all-children="yes"]
To override the alphabet used by the plugin:
[a-z-listing display="posts" alphabet="Aa,Bb,Cc,Dd,Ee,Ff,Gg,Hh,Ii,Jj,Kk,Ll,Mm,Nn,Oo,Pp,Qq,Rr,Ss,Tt,Uu,Vv,Ww,Xx,Yy,Zz"]
To add numbers to the listing:
[a-z-listing display="posts" numbers="after"]
The numbers can also be shown before the alphabet:
[a-z-listing display="posts" numbers="before"]
You can group the numbers into a single collection for all posts beginning with a numeral:
[a-z-listing numbers="after" group-numbers="yes"]
To group the alphabet letters into a range:
[a-z-listing grouping="3"]
** The arguments are all optional **
display
: specifies whether to display posts or terms from a taxonomy.
posts
.posts
or terms
.posts
or terms
will default to displaying posts.numbers
: appends or prepends numerals to the alphabet.
unset
.before
or after
.before
or after
will default to appending numerals to the alphabet.grouping
: tells the plugin if and how to group the alphabet.
unset
.1
or the value numbers
.numbers
will default to disabling all grouping functionality.1
the listing will group letters together into ranges.3
then a Latin alphabet will group together A
, B
, and C
into A-C
. Likewise for D-F
, G-I
and so-on.numbers="before"
or numbers="after"
attribute then they will be shown as a single separate group 0-9
.numbers
it will group numerals into a single group 0-9
.numbers="before"
or numbers="after"
attributes.group-numbers
: tells the plugin to group all items beginning with a numeral into a single collection.
false
.true
, yes
, on
, or 1
to group items beginning with a numeral in a single collection. All other values will keep the default behaviour.symbols-first
: Tells the plugin to put the unknown alphabet letter (symbols) group before the main alphabet.
false
.true
, yes
, on
, or 1
to put the symbols group before the alphabet. All other values will keep the default behaviour.alphabet
: allows you to override the alphabet that the plugin uses.
unset
.Admin -> Settings -> Site Language
it will use that translation.AÁÀÄÂaáàäâ,Bb,Cc,Dd,EÉÈËÊeéèëê,Ff,Gg,Hh,IÍÌÏÎiíìïî,Jj,Kk,Ll,Mm,Nn,OÓÒÖÔoóòöô,Pp,Qq,Rr,Ssß,Tt,UÚÙÜÛuúùüû,Vv,Ww,Xx,Yy,Zz
.,
.post-type
: sets the listing to show a specific post-type.
page
.,
) e.g. post-type="page,post"
.slug
of the post-type(s).parent-post
: sets the parent post that all displayed posts must be descended from.
unset
.ID
of the parent post.get-all-children="yes"
to also include all descendants of any depth below the parent post.exclude-posts
: remove these posts from the list.
unset
.,
.ID
of the post(s).taxonomy
: sets the taxonomy containing the terms specified in the terms=""
option.
unset
.slug
of the taxonomy.terms
: sets the taxonomy terms for filtering posts.
unset
.taxonomy
.,
.slug
of the term(s).taxonomy
: sets the taxonomy to display terms from in the listing.
unset
.,
.slug
of the taxonomy.terms
: sets the taxonomy terms to include in the listing.
unset
.taxonomy
.,
.ID
of the term(s).exclude-terms=""
.exclude-terms
: sets the terms to exclude from display.
unset
.taxonomy
.,
.ID
of the term(s).terms=""
.parent-term
: set the parent that all displayed terms must be descended from.
unset
.slug
of the parent term.get-all-children="yes"
to also include all descendants of any depth below the parent term.get-all-children
: when a parent term is chosen this option is used to show all children of any depth or only direct children.
false
.true
, yes
, on
, or 1
to include all children of any depth. Any value other will use the default behaviour of only showing direct children.hide-empty-terms
: hide terms that have no posts associated.
false
.true
, yes
, on
, or 1
to hide the empty terms. Any other value will use the default behaviour of showing all terms.** You should not need to touch these, as they are meant for internal use by the plugin only**
target
: the default target for a listing that doesn’t show any items.
unset
.return
: what type of listing to show, either listing
or letters
.
listing
.listing
to display the default view, or letters
to show only the letters without any items (posts or terms).The best way to use the plugin from PHP is to call do_shortcode( '[a-z-listing]' );
and save or echo
the returned text. The parameter passed to do_shortcode()
should be a complete A-Z Listing shortcode with parameters as above.
Where $query
is one of the following:
WP_Query
parameter arrayWP_Query
object formed from new WP_Query();
get_pages()
parameter array. This array must include a child_of
key or a parent
key to tell the plugin that it is a get_pages()
queryFull API documentation is available at A-Z-Listing Reference
Multiple column layout is the default on wide screens. A letter’s group of items must contain at least 15 items to create two or more columns. This is to provide a more aesthetically pleasing view when a list is short with only a few items.
The plugin allows the site owner, developer, or themer to provide custom templates for the A-Z Listing output.
NOTE: These functions have changed name and method of access in 1.0.0. We have dropped the _a_z_
moniker in the function name and within the template file they are accessed via the $a_z_listing
object. The former function names are still accessible, but are largely deprecated.
To add a template to your theme, you need a file similar to the templates/a-z-listing.php
file in the plugin folder. Your copy needs to be placed within your theme at the theme root directory and called a-z-listing.php
or a-z-listing-section.php
(where -section
is an optional top-level page slug for the section-targeting feature).
The theme system this plugin implements is very similar to the standard WordPress loop, with a few added bits.
Important functions to use in your template are as follows:
$a_z_query->the_letters()
prints the full alphabet, and links the letters that have posts to their section within the index page.$a_z_query->have_letters()
returns true or false depending on whether there are any letters left to loop-through. This is part of the Letter Loop.$a_z_query->have_items()
behaves very similarly to Core’s have_posts()
function. It is part of the Item Loop.$a_z_query->the_letter()
similar to Core’s the_post()
, this will set-up the next iteration of the A-Z Listing’s Letter Loop. This needs to wrap-around the Item Loop.$a_z_query->the_item()
similar to Core’s the_post()
, this will set-up the next iteration of the A-Z Listing’s Item Loop, the same way the normal WordPress Loop works. This needs to be within the Letter Loop.When you are within the Item Loop you may utilise all in-built WordPress Core post-related functions such as the_content()
. Note that titles and permalinks have helper functions to cope with the A-Z Listing showing taxonomy terms (see the next section).
I advise that you start with a copy of the default template template when customizing your own version. The supplied templates show the usage of most of the functions this plugin provides.
The plugin supports displaying taxonomy terms as though each term were a post. This means that the WordPress functions related to posts such as the_title()
and the_permalink()
are unreliable. We have therefore added helper functions which will return or print the correct output for the item.
NOTE: These functions have changed name and method of access in 1.0.0. We have dropped the a_z moniker in the function name and within the template file they are accessed via the $a_z_listing
object. The previous function names are still accessible, but are largely deprecated.
These helper functions cope with the dual usage of the plugin supporting both WP_Query
-based (returning WP_Post
objects) and Taxonomy Terms (returning WP_Term
objects) listings. These are:
$a_z_query->the_title()
– prints the current item’s Title$a_z_query->get_the_title()
returns the current item’s Title but does not print it directly$a_z_query->the_permalink()
prints the current item’s Permalink$a_z_query->get_the_permalink()
returns the current item’s Permalink but does not print it directly1499 websites
a-z-listing
Free Plugin