This members-only tutorial is similar to [Shortcode] Unlinked Taxonomy Terms with the following differences:

  1. The terms will be linked to corresponding term archive pages.
  2. There is an additional exclude parameter for the shortcode using which one or more term IDs can be excluded.

The shortcode shared here allows you to display comma-separated linked terms of the specified taxonomy (can be standard ones or a custom taxonomy) when viewing single pages of a post or any other Custom Post Type.

Ex.:

[post_terms_linked taxonomy="portfolio_category" exclude="32,212" before="Categorized under: "]

Let's say a portfolio Custom Post Type item has been these portfolio_categorys: Branding and Featured.

Assuming a scenario where you have selected the "Featured" portfolio category for the purposes of making this CPT entry appear inside a slider on the homepage you would typically not want "Featured" to appear in this post's terms list.

Output of [post_terms_linked taxonomy="portfolio_category"]:

Output of [post_terms_linked taxonomy="portfolio_category" exclude="45"] where 45 is the ID of "Featured" term:

The available shortcode parameters (all optional) are:

  • taxonomy: name of a taxonomy. Default: category
  • exclude: Comma-separated IDs of post terms to be excluded. Do NOT put space after commas. Default: ''
  • sep: String that should separate each term link. Default: , (a comma followed by a space)
  • before: String to appear before the terms. Default: Filed Under:
  • after: String to appear after the terms. Default: ''

Step 1

Install and activate Code Snippets plugin.

Go to Snippets > Add New.

Title: [Shortcode] Linked Taxonomy Terms

Code:

This is a premium members-only content.

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

Already a member? Log in below or here.

Need help implementing a tutorial in your site or want to hire me for custom work?

HIRE ME

Find the article helpful and wish to donate?

DONATE

Comments

You need to be logged in to view and post comments.
Not a member yet? Join here.
magnifiercross
>
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram
%d bloggers like this: