If first category

On this page:



The if_first_category tag is a conditional tag and always used as an opening and closing pair, like this…

    …conditional statement…

The tag will execute the contained statements if the current category (usually one inside the container or form of a category_list) is the first in the currently displayed list.


This tag has no attributes.


Example 1: Identify first category in a category list

<txp:category_list parent="group-1" children="0">
            <txp:category />
    <txp:else />
        <txp:category link="1" />

Prevents the first category in the list from being hyperlinked to a category page. Why you might do it? If you nest categories under a ‘header’ category you might want to show the header of the group but not allow people to link to its category page.

Other tags used: category, category_list, else.


Version 4.0.7

Tag support added.

See something wrong in this document? Outdated info, a broken link, faulty code example, or whatever? Please open an issue and we’ll investigate.