Not a developer? Go to MovableType.com

Documentation

EntryCategories

A container tag that lists all of the categories (primary and secondary) to which the entry is assigned. If multiple categories (primary and subcategory) are assigned to an Entry, the EntryCategories tag will return them in the order they were added (that is, not alphabetically, and not by hierarchy).

This tagset creates a category context within which any category or subcategory tags may be used.

<mt:Entries>
    <mt:EntryCategories>
        <!-- do something -->
    </mt:EntryCategories>
</mt:Entries>

Attributes

  • glue: If specified, this string is placed in between each result from the loop.

Examples

List and link all entry categories:

Note that this example does not necessarily return a correct hierarchical listing of the entry’s categories and is therefore not useful for generating breadcrumbs. (How to create breadcrumbs.)

<mt:Entries>
    <mt:EntryCategories glue=", ">
        <a href="<mt:ArchiveLink type="Category">">
            <mt:CategoryLabel></a>
    </mt:EntryCategories>
</mt:Entries>

If entry primary category label matches the label of the category in the loop, then make it bold:

<mt:Entries>
    <mt:EntryCategory setvar="entry_category">
    <ul>
    <mt:EntryCategories>
        <li><a href="<mt:ArchiveLink type="Category">"><mt:If tag="CategoryLabel" eq="$entry_category"><strong><mt:CategoryLabel></strong><mt:Else><mt:CategoryLabel></mt:If></a></li>
    </mt:EntryCategories>
    </ul>
    <mt:Var name="entry_category" value="">
</mt:Entries>

If entry category is in the set (Explore, Savor, Inside, Offbeat, Celebrate), add the category basename as a class and link to category archive.

<mt:Entries>
    <mt:EntryCategories>
        <mt:If tag="CategoryLabel"
            like="(Explore|Savor|Inside|Offbeat|Celebrate)">
            <mt:SetVarBlock name="category_basename"><mt:CategoryBasename></mt:SetVarBlock>
        </mt:If>
    </mt:EntryCategories>
    <div class="post <mt:Var name="category_basename">">
        <mt:EntryCategories>
            <mt:If tag="CategoryLabel" like="(Explore|Savor|Inside|Offbeat|Celebrate)">
            <a href="<mt:ArchiveLink type="Category">"><mt:CategoryLabel></a>
            </mt:If>
        </mt:EntryCategories>
        <!-- more entry data here -->
    </div>
    <mt:SetVar name="category_basename" value="">
</mt:Entries>
Back

Leave a Comment