Published on Sep 7, 2019

[Shortcode] Unlinked Taxonomy Terms

Sridhar Katakam

Updated on January 23, 2021

This members-only tutorial provides the steps to register a custom shortcode using which unlinked terms of any taxonomy (like the standard categories or any custom taxonomy) can be displayed either comma/space separated or as an unordered list in WordPress.

Ex.:

[post_terms_unlinked before="Project Type(s): " taxonomy="project_type" sep=", "]

will output comma-separated terms of project_type custom taxonomy where each term is NOT linked (to the corresponding term archive) with the string, "Project Type(s):" at the front.

This is somewhat similar to the earlier How to display taxonomy terms in Oxygen tutorial except the terms are unlinked here.

if taxonomy attribute and value are not provided in the shortcode, the default category will be used.

Shortcode attributes:

taxonomy : The name of the taxonomy terms to pull. Default: category .
list : Whether to output as an unordered list. Default: true .
sep : separator. Default: empty string.
before: The string to appear at the beginning of the terms. Default: empty string.
after : The string to appear at the end. Default: empty string.

Examples

List

[post_terms_unlinked taxonomy='property_feature']

HTML output:

<ul class="entry-terms"><li>Ceramic showers</li><li>Engineered wood flooring</li><li>Indoor parking</li><li>Large modern oversized ceramics</li><li>Large private balconies</li><li>Large windows</li><li>Modern 5 panel doors</li><li>Private roof top terrace</li><li>Train Station Gare du Canal</li></ul>

Comma-separated

[post_terms_unlinked taxonomy="property_feature" list="false" sep=", "]

HTML output:

<span class="entry-terms">Ceramic showers, Engineered wood flooring, Indoor parking, Large modern oversized ceramics, Large private balconies, Large windows, Modern 5 panel doors, Private roof top terrace, Train Station Gare du Canal</span>

Comma-separated with before and after text

[post_terms_unlinked taxonomy='property_feature' list='false' sep=', ' before='Filed Under: ' after='.']

HTML output:

<span class="entry-terms">Filed Under: Ceramic showers, Engineered wood flooring, Indoor parking, Large modern oversized ceramics, Large private balconies, Large windows, Modern 5 panel doors, Private roof top terrace, Train Station Gare du Canal.</span>

Step 1

Install and activate Code Snippets plugin.

Go to Snippets > Add New.

Title: [Shortcode] Unlinked Post Terms

Code:

This is a premium members-only content.

To view the rest of the content, please sign up for membership ($47/month or $499 one-time).

Already a member? Log in below or here.

tagschevron-leftchevron-rightchainangle-rightangle-upangle-downfolder-ocalendar-check-omagnifiercrossmenuchevron-downarrow-right