Forum
Pulling Category Field
I want to echo a color assigned to a category on a category page of the blog.
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" />
I then created a template called templates/blog/emailColor.html that contains: <perch:categories> <perch:category id="color" type="select" /> <perch:categories>
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
Spoke too soon. I figured this out.
perch_blog_categories(array( 'template' => 'emailColor.html', 'filter' => 'catSlug', 'match' => 'eq', 'value' => perch_get('cat'), ));