tags:

views:

27

answers:

1

Hi

I want to specify one <CategoryLabel> in <MTEntryCategories> in archive template.

For example my categories are like this (x is selected category in entry):

Fruit --Apple --Grape

Drinks --Coffee -x-Beer --Juice

Vacation --France -x-UK

In this case I want to display the label under "Drinks" in a entry (sample code)

<MTSubCategories category="Drinks">
   <MTEntryCategories>
       <h1><$MTcategory_label$><h1>
   </MTEntryCategories>
</MTSubCategories>

I know there are various plugin that do this but I couldn't find one that supports MT5. If anyone know if there is a way to do this without the plugins, greatly appreciated!

+1  A: 

If I'm understanding your question correctly, you would like to do display the category for the entry that is a sub-category of Drinks in an h1.

If that is the case, here is what I would do in MT4 (without a plugin):

<mt:entrycategories>
    <mt:ifisdescendant parent="Drinks">
        <h1><mt:categorylabel></h1>
    </mt:ifisdescendant>
</mt:entrycategories>

This will step through each of the categories for the entry and, if the category is a sub-category of Drinks, it will output the label in an h1.

rayners
Wow this is brilliant. It worked!
Maca