Textpattern CMS Template Tags

<txp:category /> sing/cont tag, 8 attributes

category

The category tag can be used as either a single or containing tag. It will display information of the category as defined by the name attribute, or the one currently being viewed. When used as a containing tag, it will turn the contents into a link to the category. Otherwise, it will return plain text.

May be used in any context.

attributes

name="unset" 
  • Display specific category. Note the category name is specified in lower case regardless of how you typed its title in the Category tab. Also note that if you had called your category My Category Name it becomes my-category-name when used in tags.
type="article" 
  • Values: article, image, link, file.
title="0" (boolean) 
  • Whether to display category’s title.
link="0" (boolean) 
  • Whether to display as link.
section="current section" 
  • Restricts category search to named section.
this_section="0" (boolean)
  • Only link to articles from the current section. section attribute overrides this setting.
class="unset" 
  • (X)HTML class attribute, applied to wraptag. If no wraptag is supplied (and link=“1”), the class is applied to the anchor instead.
wraptag="unset" 
  • (X)HTML tag (without brackets) to wrap around output.

genealogy

Version 4.0.7

  • Applies class attribute to the <a> element when wraptag is empty.

Version 4.0.4

  • this_section added.
<txp:category /> 4 examples

Displays the current category name

<txp:category />

Display hyperlinked category title

<txp:category title="1" link="1" />

Display a specific category’s title, hyperlinked

<txp:category name="articles" title="1" link="1" wraptag="p" />

Container Example

<txp:category name="book">My books</txp:category>