<mt:Categories>

Produces a list of categories defined for the current blog.

Categories in this blog:
<mt:Categories glue=", ">
    <a href="<$mt:CategoryArchiveLink$>"><$mt:CategoryLabel$></a>
</mt:Categories>

This tag produces output for every category with no regard to their hierarchical structure. The results are sorted ascending by category label.

The tags mt:TopLevelCategories and mt:SubCategories may be more useful for complex listings of categories.

Attributes

blog_ids

A comma delimited list of blog ids specifying which blogs to include categories from, or the word “all” to include categories from all blogs in the installation.

This attribute aggregates categories from multiple blogs:

<mt:Categories blog_ids="1,12,19,37,112">

A value of “all” expands the context to all blogs (in the installation) except those blogs which have been explicitly forbidden their content from being aggregated in the Multiblog blog plugin settings.

<mt:Categories blog_ids="all">

Alias of include_blogs.

class_type

Accepted values are “category” (default) and “folder”. Because folders are essentially categories for pages, category and folder template tags are interchangeable. Using <mt:Folders> is the same as using <mt:Categories class_type="folder">.

exclude_blogs

A comma delimited list of blog ids specifying which blogs to exclude categories from when including categories from all blogs in the installation.

This attribute aggregates categories from all blogs except those with ids specified:

<mt:Categories exclude_blogs="1,12,19,37,112">

Blogs which have been explicitly forbidden their content from being aggregated in the Multiblog blog plugin settings are not included.

Related to blog_ids.

glue

A string used to join the output of the separate iterations of MTCategories. This can be as simple as a comma and space (“, ”) to list out category labels or complex HTML markup to be inserted between the markup generated by MTCategories.

include_blogs

Alias of blog_ids. Related to exclude_blogs.

lastn

Limits output to the first N categories. N is a positive integer.

show_empty

Setting this optional attribute to true (1) will include categories with no entries assigned. The default is false (0), where only categories with entries assigned.

Examples

List out the categories used on at least one blog entry, separated by commas:

Categories: <mt:Categories glue=", "><$mt:CategoryLabel$></mt:Categories>

List all categories and link to categories it the category has one or more entries:

<mt:Categories show_empty="1">
    <mt:If name="__first__">
<ul>
    </mt:If>
    <mt:If tag="CategoryCount" gte="1">
    <li><a href="<$mt:CategoryArchiveLink$>"><$mt:CategoryLabel$></a></li>
    <mt:Else>
    <li><$mt:CategoryLabel$></li>
    </mt:If>
    <mt:If name="__last__">
</ul>
    </mt:If>
</mt:Categories>
This page was last updated on 2009-06-22, 15:19. [Edit]

4 Notes

This tag supports the MultiBlog template tag attributes blog_ids/include_blogs and exclude_blogs for aggregating across different blogs.

This page has a minor typo. I attempted to edit it myself but I guess that option is not available to the community.

List all categories and link to categories it the category has one or more entries:

Should be...

List all categories and link to categories "if" the category has one or more entries:

Thanks for the info

Leave a note

Have a question? Please use the MT Forums. Notes submitted on documentation should pertain to tips & hints regarding documentation. Your note may be removed once its contents have been integrated into the body of the page.