[terms] Shortcode

Estimated reading: 2 minutes 478 views

Summary: The [[terms]] shortcode in the Docy theme dynamically displays taxonomy lists in WordPress.

The [[terms]] shortcode in the Docy theme is a versatile and useful tool for displaying taxonomy lists associated with various post types in WordPress. By default, it is configured to show the category list of a post, but its flexibility lies in its ability to showcase any taxonomy list through the use of the tax attribute.

See the shortcode-rendered output here.

Usage

Default Behavior

  • Basic Structure: The basic shortcode [[terms]] without any attributes will display the category list of the current post.
  • Example: In a post, simply writing [[terms]] will automatically pull and display the list of categories that the post belongs to.

Custom Taxonomy Display

  • Using tax Attribute: To display a different taxonomy, use the tax attribute within the shortcode.
  • Syntax: [[terms tax="taxonomy_name"]]
  • Example: If you want to display tags instead of categories, you would write [[terms tax="post_tag"]].

Attributes

  • tax: Specifies the taxonomy type to display. This can be categories, tags, or any custom taxonomy registered in WordPress.

Examples

  1. Displaying Tags:
  • [[terms tax="post_tag"]]
  • This will show a list of tags associated with the post.
  1. Custom Taxonomy:
  • [[terms tax="custom_taxonomy"]]
  • Replace custom_taxonomy with the name of your custom taxonomy to display its terms.

Best Practices

  • Check Taxonomy Registration: Ensure that the taxonomy you want to display is properly registered in WordPress.
  • Styling and Appearance: The appearance of the taxonomy list will depend on the theme’s CSS. Customize the styles as needed to match your site’s design.
  • Use in Relevant Contexts: This shortcode is most effective when used in contexts where the taxonomy information adds value to the content, such as in blog posts or custom post types.

Conclusion

The [[terms]] shortcode in the Docy theme is a powerful tool for dynamically displaying taxonomy lists in WordPress. Its simplicity and flexibility make it suitable for a wide range of applications, enhancing the way taxonomies are presented on your website.

Leave a Reply

Your email address will not be published. Required fields are marked *

Share this Doc

[terms] Shortcode

Or copy link

CONTENTS