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.

Displaying Custom Category Fields

June 14, 2012 12:45pm

Subscribe [3]
  • #1 / Jun 14, 2012 12:45pm

    bgomski

    3 posts

    I’d like to be able to display a categories’ custom fields on a given page.

    I don’t really know what syntax/tags to use and I haven’t had any luck finding in the documentation.

    Anyone have an example of how I might do this?

    Any help would be much appreciated!

  • #2 / Jun 14, 2012 1:03pm

    Rob Allen

    3114 posts

    Hi bgomski welcome to the forums

    Is this inside a Channel entry, or when you output a list of categories?

  • #3 / Jun 14, 2012 4:10pm

    bgomski

    3 posts

    Thanks Rob!

    Ideally the category and its custom fields would be placed outside the channel:entries tags. (or at least seem independent of the channel entries loop such that it doesn’t repeat over and over)

    Is that possible?

  • #4 / Jun 14, 2012 5:39pm

    bgomski

    3 posts

    I might be missing a key concept with Expression Engine (im a newbie) so bear with me.

    I approached Custom Category Fields with the idea that I might be able to place these fields in the “header” of a layout on a given page. And with that I could make these fields editable without having to set up a new channel for something the user wouldn’t be updating very often.

    I suppose I could get it done as a channel but I wanted to wrap my head around how to use these Custom Category Fields. So, thought I’d ask.

  • #5 / Jun 15, 2012 5:15am

    Rob Allen

    3114 posts

    Assuming you use the standard category tag you can add custom fields inside the tag loop, by simply using the custom field short name:

    {exp:channel:categories channel="mychannel"}
    
      <h1>{category_name}</h1>
    
      {if category_description}
        {category_description}
      {/if}
    
      {cat_custom_field1}
    
      {cat_custom_field2}
    
    {/exp:channel:categories}

    The docs are your friend here, see the Category sections at http://ellislab.com/expressionengine/user-guide/modules/channel/index.html for a full list of parameters and variables.

  • #6 / Jun 15, 2012 11:57am

    Shane Eckert

    7174 posts

    Hey bgomski,

    I am glad to see that Rob was able to help you out!

    Is there anything else I can help you with?

    Cheers,

  • #7 / Jun 15, 2012 4:39pm

    bgomski

    3 posts

    Great, that’s exactly what I was looking for.

    Thanks Rob!

  • #8 / Jun 15, 2012 4:40pm

    Shane Eckert

    7174 posts

    Hey bgomski,

    Glad to see that Rob was able to help!

    If you need anything else, please just let me know by opening a new thread.

    Cheers,

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

ExpressionEngine News!

#eecms, #events, #releases