[term_title]
The shortcode displays the title of a term (category, tag, or custom taxonomy).
Product
Shortcode Attributes
- id – Term ID. If not provided, the shortcode will use the current term.
- Options: Any numeric value.
- taxonomy – The taxonomy of the term (e.g.,
category,post_tag, or custom taxonomy).- Options: Any text value.
- first_word_only – If set to “on”, only the first word of the term title will be displayed.
- Default:
off. - Options:
on,off. Specify one only.
- Default:
- append – Text to append to the term title (e.g., adding a prefix like “Category: “).
- Options: Any text value.
- prepend – Text to prepend to the term title (e.g., adding a prefix like “Category: “).
- Options: Any text value.
- label – A label to display before the term title.
- Options: Any text value.
Shortcode Enclosed Content
Any content placed between [term_title] and [/term_title] will be used as a template, where {content} acts as a placeholder for the post description.
Example Usage
Example 1
[term_title label="Term: "]
Results
<label>Term: </label>Technology
| This example displays the term title with a label “Term: ” before it. |
id nor taxonomy is provided, the shortcode will default to the current term being queried.Example 2
[term_title id="5" taxonomy="category" first_word_only="on" prepend="Category: " append="s"]
Results
Category: News
| This example displays only the first word of the current term title and prepend “Category: ” and append an “s” to the term title. |
append attribute will only add text if the last letter of the term title is not “s”.Example 3
[term_title]<h2>{content}</h2>[/term_title]
Results
<h2>Travel</h2>
This example displays wrap the term title in an <h2> tag. The {content} placeholder is replaced with the term title. |
{content} placeholder is used to dynamically insert the term title into custom content.