ShortCode

[tws_get_term]

This ShortCode is part of the ToolWine ShortCodes Plugin. Download and Install the ToolWine ShortCodes Plugin to use it. Note that the Plugin requires Toolset Types and Views (or Blocks) installed and active.

The [tws_get_term] ShortCode allows to get and display any term data by any term field supported by the WP Term Object. It allows to output the data in Human Readable and sanitised format or comma separated.

It’s very helpful when you want to display for example data of a Taxonomy Term outside a Toolset View, or Archive, or on a different Archive than currently shown.
It can be used in conditionals and to build custom Links to archives as well, when mixing with Toolset ShortCodes it becomes even more powerful as the inner shortcodes will be expanded, hence you can populate attributes dynamically.

Attributes:

  • fieldstring [term field to find by]
  • valuemixed [value to scan field for]
  • taxonomystring [taxonomy name]
  • outputstring [what object property to output]
  • filterstring [how to filter output]

Example:

//get term archive url by term ID
[tws_get_term field="term_id" value="1" taxonomy="categery" output="archive-url" filter="raw"]
//display term description by term slug
[tws_get_term field="term_name" value="the-term" taxonomy="gender" output="description" filter="display"]
//get post count of term by ID
[tws_get_term field="term_id" value="33" taxonomy="brands" output="count" filter="raw"]