Movable Type Enterprise Documentation

Back to docs index

Chapter Category

In this section:


The total count of categories for the current blog.

A container tag representing a list of categories in a weblog. This tag produces output for every category with no regard to their hierarchical structure.

  • 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 entry assignments are displayed.

A link to the archive page of the category.

Produces the dirified basename defined for the category in context.

Optional attributes:

  • separator -
  • default -

The number of published entries for the category.

The description for the category.

The numeric system ID of the category.

A conditional tag that displays its contents if pings are enabled for the category in context.

For more details see the relevant section of Chapter 8 in the Users and Administrators Guide entitled "Conditional Tags".

You can download the Users and Administrators Guide here.

The category label.

A container tag which creates a category context of the next category relative to the current entry category or archived category.

Optional attribute:

  • show_empty - Specifies whether categories with no entries assigned should be counted

Example code:

<MTCategoryNext>
    Next Category: <a href="<MTArchiveLink archive_type="Category">"><MTCategoryLabel></a>
</MTCategoryNext>

A container tag which creates a category context of the previous category relative to the current entry category or archived category.

Optional attribute:

  • show_empty - Specifies whether categories with no entries assigned should be counted

Example code:

<MTCategoryPrevious>
    Previous Category: <a href="<MTArchiveLink archive_type="Category">"><MTCategoryLabel></a>
</MTCategoryPrevious>

The number of published TrackBack pings for the category in context.

The URL that TrackBack pings can be sent for the category in context.

A conditional block which tests attributes of the category currently in context and outputs its contents on a match.

This tag can be used anywhere where there is a category context:

  • Within an MTEntries loop
  • In a category archive template
  • Within an MTCategories loop
  • Etc

Required attributes

  • name - Name of category for conditional test
  • label - Alias of name attribute above

Optional attribute

  • type - Tests for the assignment type for the category, accepting values of primary and secondary.

NOTE: There is currently a known issue related to this in that the value of 'secondary' is not accepted by the type attribute.

Example code

Conditional output based on category:

<MTIfCategory label="important">
    This is important
<MTElse>
    Misc is not so important
</MTElse>
</MTIfCategory>

This can be used in conjuction with CSS rules to display things differentially. This adds a class attribute of featured to the entry title h2 tag if the category of the entry is "Featured":

<h2 <MTIfCategory name="Featured">class="featured"</MTIfCategory>>
   <MTEntryTitle>
</h2>

Below is a full example testing for not only category assignment, but also the type of assignment.

<MTIfCategory label="misc" type="primary">
    Misc is the primary category
<MTElse>
    <MTIfCategory label="misc" type="secondary">
        Misc is the secondary category
    <MTElse>
        Misc is neither a primary not secondary category
    </MTElse>
    </MTIfCategory>
</MTElse>
</MTIfCategory>
Six Apart
Makers of weblog software and services for individuals, organizations and businesses.
This website is powered by Movable Type.