In the members-only forum, a user asked:
Hello!
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
[alphabetical-archives taxonomy="product_cat"]
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]
or [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.
Screencast:
Step 1
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.
Is there a way to pull links from the old WP Link Manager? Something replacing…
‘taxonomy’ => ‘post_tag’
with
‘taxonomy’ => ‘links’
Can you please tell me what to do if I have parent/child terms in a taxonomy. I want the alphabet to be linked to the first letter of the parent. Then I want the list below to have parents and childs also. This is the page I want the alphabet to > https://www.architravel.com/plan-your-trip/