ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Category Limit

November 14, 2012 12:02am

Subscribe [1]
  • #1 / Nov 14, 2012 12:02am

    trace

    7 posts

    I have several entries with multiple categories assigned, it is possible to only display only the 1st category?
    limit=“1” does not seem to be a valid parameter

    {exp:channel:entries channel="work" limit="1"}
      {categories}
       {category_name} | {title}   
      {/categories}
    {/exp:channel:entries}

    thanks
    /trace

  • #2 / Nov 15, 2012 3:19pm

    Dan Decker

    7338 posts

    Hi trace,

    Sure thing!

    You need to use the limit= parameter on the {categories} variable pair. The limit parameter in channel entries only affects how many entries are returned:

    {exp:channel:entries channel="work" limit="1"}
      {categories limit="1"}
       {category_name} | {title}   
      {/categories}
    {/exp:channel:entries}

    Give that a whirl.

    Cheers,

  • #3 / Nov 15, 2012 10:20pm

    trace

    7 posts

    thanks dan, works great!
    /trace

  • #4 / Nov 20, 2012 4:43pm

    Dan Decker

    7338 posts

    Excellent!

    If you need anything else, please let me know!

    Cheers,

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases