Not a developer? Go to MovableType.com

Documentation

HasParentCategory

Returns true if the current category has a parent category.

<mt:Categories>
    <mt:HasParentCategory>
        <$mt:CategoryLabel$> has a parent category.
    </mt:HasParentCategory>
</mt:Categories>

This type of conditioning can be done with the mt:IfCategory tag as well.

Example

List categories noting if each has a parent or not. If has a parent, list the parent category:

<ul>
<mt:Categories>
    <li>
    <mt:HasParentCategory>
        <$mt:CategoryLabel$> has a parent category.
        <mt:ParentCategory>
            (Parent Category: <a href="<mt:ArchiveLink>"><mt:CategoryLabel></a>)
        </mt:ParentCategory>
    <mt:Else>
        <$mt:CategoryLabel$> has no parent category.
    </mt:HasParentCategory>
    </li>
</mt:Categories>
</ul>
Back

Leave a Comment