Forum

Thread tagged as: Question, Problem

Pulling Category Field

I want to echo a color assigned to a category on a category page of the blog.

  1. I have added the following code to templates/categories/category.html: <perch:category id="color" type="select" label="Email Color Theme" options="blue,red,orange,green,violet" />

  2. I then created a template called templates/blog/emailColor.html that contains: <perch:categories> <perch:category id="color" type="select" /> <perch:categories>

  3. I then tried to display the color associated wit that category like this: <?php
    perch_blog_categories(array( 'template' => 'emailColor.html', 'category' => perch_get('cat'), )); ?>

All assigned color values are returned. I only want the color assigned to the perch_get('cat'). I'm close, but I can't figure it out from here. Any help would be appreciated. Thanks

Jared Medley

Jared Medley 0 points

  • 6 years ago

Spoke too soon. I figured this out.

perch_blog_categories(array( 'template' => 'emailColor.html', 'filter' => 'catSlug', 'match' => 'eq', 'value' => perch_get('cat'), ));