Not a developer? Go to MovableType.com

Documentation

ParentCategories

A block tag that lists all the ancestors of the current category.

Output all parent categories and glue using a forward slash:

<mt:ParentCategories glue ="/">
    <$mt:CategoryLabel$>
</mt:ParentCategories>

The above templating will output something like the following:

Parent Category/Sub-Category/Sub-Sub-Category

Attributes

exclude_current

This optional boolean attribute controls the exclusion of the current category in the list.

glue

This optional attribute is a shortcut for connecting each category label with its value.

Examples

Use the following code on Category archive template. If the current category has a parent category, loop through the parent categories starting at the top level (excluding the current category), then output the title of the current archive.

<mt:HasParentCategory>
    <mt:ParentCategories exclude_current="1">
        <a href="<$mt:CategoryArchiveLink$>"><$mt:CategoryLabel$></a> /
    </mt:ParentCategories>
</mt:HasParentCategory>
<$mt:ArchiveTitle$>

On an Entry archive template:

<mt:HasParentCategory>
    <mt:ParentCategories>
        <a href="<$mt:CategoryArchiveLink$>"><$mt:CategoryLabel$></a> /
    </mt:ParentCategories>
</mt:HasParentCategory>
<$mt:EntryTitle$>

The glue attribute can be used to create “fancy” breadcrumbs:

<mt:ParentCategories glue ="&nbsp;&raquo;&nbsp;">
    <$mt:CategoryLabel$>
</mt:ParentCategories>

Which outputs:

Parent Category » Sub-Category » Sub-Sub-Category

Back

Leave a Comment