Movable type tag into class name

106 Views Asked by At

I have a TypePad blog, and I would like to add each respective category label into the Div class name - this is so I can stylize how entries show for different categories (maybe a Food category will have a yellow background, an art entry will have a green background and so on)

So far, I've got this:

     <div class="entry <$MTCategoryLabel dirify="1"$>" id="entry-<$MTEntryID$>">

The problem is that nothing shows but:

     <div class="entry " id="entry-postnumberhere">

So, TypePad is not recognizing the category that each post is assigned to.

Is there something I'm missing here to make this work?

Thanks ahead!

1

There are 1 best solutions below

0
Dan Wolfgang On

The CategoryLabel tag requires the Category context, but you're in the Entry context. You can get into the Category context by doing the following, which will output the name of each category assigned to an entry:

<div class="entry <mtEntryCategories><$MTCategoryLabel dirify="1"$> </mtEntryCategories>" id="entry-<$MTEntryID$>">

Or, you can just output the primary (first) category assigned to an entry:

<div class="entry <mtEntryCategory>" id="entry-<$MTEntryID$>">