I'm on a single product entry page. The URL does not specify the category. In fact, the entry has 3 category groups associated with it. I want to display the first category assigned from each of the category groups.

Here's the code I have so far:

{exp:channel:entries channel="products" limit="1" }
<div id="prodinfo">

    {exp:channel:categories category_group="4" note="vehicle type"}

</div> <!-- END #prodinfo -->

This is displaying all the categories in the group. I've also tried using the {if active} conditional variable, but as it relies on the URI, it's not working for me.

Thanks for your help.

1 Answer 1


I think you're trying to use the wrong tag here.

That exp:channel:categories tag is for when you want to display a list of all the categories on your site - and possibly link to those "category listing" pages.

Here's how I display an individual entry's category:

{exp:channel:entries channel="spc-content" limit="1" rdf="off" show_future_entries="no" status="open|Featured" require_entry="yes"}
{categories}<a href="{path=obsessive/compulsions}">{category_name}</a> {/categories}

To change your code to display what you want, try this:

{exp:channel:entries channel="products" limit="1" }
<div id="prodinfo">


</div> <!-- END #prodinfo -->
  • 1
    To expand you might want {categories limit="1"} to only show one tag - more: ellislab.com/expressionengine/user-guide/modules/channel/…
    – liamcrean
    Commented Mar 21, 2013 at 15:51
  • Good point @llamcrean makes - if you want to display all the categories an entry is tagged with, my example works. If you only want to display one...use the limit parameter.
    – user800
    Commented Mar 21, 2013 at 15:53
  • Yeah, I got that. Once @Leigh pointed me to the {categories} tag, I went and read the docs. Got everything happening the way I wanted. Thanks again. Commented Mar 21, 2013 at 17:42
  • besides limit="1" any way to also restrict to a specific category group? category_group="1" doesn't seem to work for me when using the categories tag inside channel entries.
    – user3597
    Commented Sep 19, 2014 at 5:06
  • You want show_group= instead: ellislab.com/expressionengine/user-guide/add-ons/channel/… Commented Sep 19, 2014 at 11:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.