Question

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!

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top