Textpattern logo

Help?

category

From Textbook

<txp: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.

Contents

Attributes

Tag will accept the following attributes (case-sensitive):

name="category name"
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
Default: unset (use current category).
type="category type"
Values: article, image, link, file.
Default: article.
title="boolean"
Whether to display category's title.
Values: 1 (yes) or 0 (no, display name).
Default: 0.
link="boolean"
Whether to display as link.
Values: 1 (yes) or 0 (no).
Default: 0.
section="section name"
Restricts category search to named section.
Default: current section (for backwards compatibility).
this_section="boolean"
Only link to articles from the current section. section attribute overrides this setting.
Values: 1 (yes) or 0 (no).
Default: 0.
class="class name"
(X)HTML class attribute, applied to wraptag. If no wraptag is supplied (and link="1"), the class is applied to the anchor instead.
Default: unset.
wraptag="tag"
(X)HTML tag (without brackets) to wrap around output.
Default: unset.

Examples

Example 1: Displays the current category name

<txp:category />

Example 2: Display hyperlinked category title

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

Example 3: Display a specific category's title, hyperlinked

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

Example 4: Container Example

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

Genealogy

Version 4.0.7

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

Version 4.0.4

  • this_section added.

Translations [?]...

About Textbook