Category
Contents
Syntax
<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.
Attributes
Tag will accept the following attributes (case-sensitive) as well as the global attributes :
link="boolean"- Whether to display as link. Works only in the single tag, not in the containing tag variant.
- Values:
0(no) or1(yes). - Default:
0. name="category name"- Display specific category. Note the category name is specified in lowercase regardless of how you typed its title in the Categories panel. Also note that if you had called your category
My Category Nameit becomesmy-category-namewhen used in tags. - Default: unset (use current category).
section="section name"- Restrict to articles from specified section(s).
- Values: (comma separated list of) section name(s).
- Default: current section (for backwards compatibility).
this_section="boolean"v4.0.4+- If set to
1, the linked category name will direct users to an category list in the current section, otherwise category list from all sections is displayed. - Only link to articles from the current section. The
sectionattribute overrides this setting. - Values:
0(no, all sections) or1(yes, this section only). - Default:
0. title="boolean"- Whether to display category’s title instead of its name.
- Values:
0(no, display name) or1(yes, display title). - Default:
0. type="category type"- Values:
article,image,linkorfile. - Default:
article. url="boolean"v4.0.7+- Display plain URL or full link.
- Values:
0(no) or1(yes). - Default:
0(display title or full link, depending onlink).
Common presentational attributes
These attributes, which affect presentation, are shared by many tags. Note that default values can vary among tags.
class="class name"- HTML
classattribute, applied towraptag. If nowraptagis supplied (andlink="1"), theclassis applied to the<a>tag instead. - Default: unset (see class cross-reference).
wraptag="tag"- HTML tag to wrap around output, specified without brackets (e.g.
wraptag="p"). - Default: unset (but see wraptag cross-reference for exceptions).
Examples
Example 1: Display 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="article" 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> tag when the wraptag attribute is empty.
url attribute added.
Version 4.0.4
this_section attribute added.