Support » Fixing WordPress » Display all terms of custom taxonomy?

  • Is there a non-coding way (hidden feature of core, plugin that makes a shortcode or block, etc.) or minimal-coding way to list the terms of a taxonomy on a page? I expected this to be simple – for example, [ redundant link removed ] gives an archive of the CPT posts in the series called “Human Journey”, so I expected a different URL like /series/ to list all the series terms. Nope, that would be too easy!

    In my sidebar I use the “List Custom Taxonomy Widget” plugin to do a small list of one of the taxonomies I want to list, but on a page I’d like an expanded version, preferably with the description of each term.

    I’m aware that get_terms() will give me the objects, but I’m hoping not to have to write my own plugin or something in order to display them. Surely this is something many people want – I feel like I’m overlooking something obvious.

    • This topic was modified 1 year, 4 months ago by Jan Dembowski. Reason: Moved to Fixing WordPress, this is not an Everything else WordPress topic

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • I had the same thought about the URL of the taxonomy root should show the terms of the taxonomy. But! WordPress doesn’t work that way. All of the built-in queries for URLs are for showing posts (content), not users or taxonomies or terms or media.

    I thought this was strange, so in my theme, I supply a Page Template called taxonomy root, that takes the slug of the page and uses it as the taxonomy slug in the get_terms() call, and outputs the links to all the term pages. This way the user can choose the slug for the page to match the taxonomy and then choose the template to take advantage of it.
    To apply this to other themes, you could create a page template like that in a child theme for your site.
    But since you don’t want to code, I have another way to do it.

    You can use a plugin like amr Shortcode Any Widget which makes a “sidebar” that is not output. Any widgets you assign there can now be used as a shortcode in a page/post. So you create a Page with the slug you want (like I describe above) and write whatever you want and put the shortcode for your taxonomy widget where you want it. There are quite a few plugins that supply taxonomy widgets.

    There might be blocks also, but I haven’t ever searched for those.

    Thread Starter OsakaWebbie


    Thanks for the ideas. The AMR plugin in conjunction with another plugin to make the widget would not prevent me from writing code, because I haven’t seen a taxonomy widget plugin that would include the term’s description (that make sense – widgets are normally used in small places). I’d much rather create a template in my child theme than hack a plugin that would have to get re-hacked every time it is upgraded.

    My theme, Hueman Pro, doesn’t have all-in-one template files but an intertwined ripple effect of calling many files for small parts of the output, and settings in Customizer can change which files are used for the same URL. I like the theme, but when I need to customize something, I struggle to find the right file to modify. That’s why I hoped to find a prefab solution. But if none exists, would you be willing to share your template with me so I can get ideas from it for how to implement something similar in my theme?

    [I don’t know why my post was moved to Fixing WordPress – nothing is broken per se. I considered posting it in Developing with WordPress, but I was hoping I wouldn’t need to develop anything… 😉 ]

    My theme is Twenty8teen, here in the WordPress repository:
    The code for the page template is in the main folder, tpl-taxonomy-root.php, but it’s hard to tell that anything special is going on there. It adds a filter to the_content which is where the additional taxonomy stuff gets added (that way a child theme could adjust it easily and it’s also called directly from the 404 page).
    Code for filters is in the inc/filters.php file.
    My code uses wp_list_categories
    but you might want to use a different function since you want the description output also.

    Thread Starter OsakaWebbie


    Catching it in the 404 page is an interesting approach, and I’ll look at your code in detail when I get time (I have to turn my attention to a different project for awhile, and applying this to the theme I’m using would take a lot of time).

    But unlike you, I don’t need it to be generic – I only have one or possibly two taxonomies I would want to list like this, so using an actual page is fine with me. It still amazes me that no one has written a plugin to do this with a block or shortcode. I keep trying different search words and still coming up empty.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Display all terms of custom taxonomy?’ is closed to new replies.