In the members-only forum, a user asked:
I'm wondering if you could create a tutorial with an archive type page template where the tags are displayed in alphabetical order, separated by letter. Similar to this recipe index (scroll below the main recipe categories). I can get the page template to display the tags in alphabetical order but not sure how to go about adding the letter separation - Bonus if no plugins are used. Thank you so much!
In this article I am going to share the code for registering a custom shortcode that displays all the terms linked to their archives of a given taxonomy grouped alphabetically. Additionally the alphabets will appear in a row and act as jump links to the respective group.
For example, placing
in WP editor will output WooCommerce product categories like this:
Clicking on the up arrow will take the visitor back to the alphabet buttons row. Clicking on an alphabet letter jumps the page to the group of product categories starting with that letter.
[alphabetical-archives taxonomy="category"] will output something like
and sample output of
[alphabetical-archives taxonomy="post_tag"] is
We are going to use CSS to split the list items into 3 columns for each alphabet.
When a non-existing or empty taxonomy is supplied as a parameter, there will be no output.
Add the following in child theme's functions.php:
To view the full content, please sign up for the membership.
Already a member? Log in below or here.