<p>The Craft <a href="http://buildwithcraft.com/docs/categories" rel="nofollow">Categories</a> page is very useful.</p>

<p>To assign an entry to a category, create a category field, and require it in the entry type (you are probably already doing this).</p>

<p>When you create a <em>Category Group</em> you can edit the field layout, and add an image field and a text field for the category. Then to edit that content, double click on the category itself (from the right-side category menu), and you will get a modal dialog where you can edit the text and image.</p>

<p>To list the categories in <em>myCategoryGroup</em> you do:</p>

<pre><code>{% set categories = craft.category.group('myCategoryGroup') %}
{% for cat in categories %}
  {{cat.title}} - {{cat.image}} {# assuming image is the name of the image field #
{% endfor %}
</code></pre>

<p>Craft site has an article on <a href="http://buildwithcraft.com/help/entries-related-to-category" rel="nofollow">How do I list the entries related to a category?</a>.</p>

CC BY-SA 3.0
2014-07-31T08:57:49.583Z
Thank you! My first issue was not realising there was a "Field Layout" tab on the category group edit page. On top of that I'm not sure I would have noticed you could "double click on the category itself".
jamus
CC BY-SA 3.0
2014-07-28T16:50:57.110Z
2014-07-28T16:50:57.110Z
Marion Newlevant
<p>I'm just getting to grips with Craft but it seems very flexible. To try it out I have set up a structure to store some sample products. These products have an image, text, tags and belong to a category (E.g cakes). I can sort and output products, display in groups even sort by tag - brilliant.</p>

<p>One thing I struggling with is how assign a image and other fields to the category? So that I can then have a page with a list of categories each with an image and text Or even output a single category that I want to highlight on another page? </p>

<p>Should this be a "parent" entry? If so how do I assign a set of fields to the parent item but not the child? </p>

<p>Possibly I am thinking about approaching this the wrong way and I should create a "types" structure in which the entries have a required field that is the "category" and use this to search for any products of matching category?</p>

<p>Confused - any pointers appreciated.</p>

<entries><category>
Possible to assign fields (or an image) to a category?
# Possible to assign fields (or an image) to a category?

(Asked by: username_0 on 2014-07-28)

I'm just getting to grips with Craft but it seems very flexible. To try it out I have set up a structure to store some sample products. These products have an image, text, tags and belong to a category (E.g cakes). I can sort and output products, display in groups even sort by tag - brilliant.

One thing I struggling with is how assign a image and other fields to the category? So that I can then have a page with a list of categories each with an image and text Or even output a single category that I want to highlight on another page?

Should this be a "parent" entry? If so how do I assign a set of fields to the parent item but not the child?

Possibly I am thinking about approaching this the wrong way and I should create a "types" structure in which the entries have a required field that is the "category" and use this to search for any products of matching category?

Confused - any pointers appreciated.

**Tags:** entries, category

---

## 1 answers

### Answer by username_1 on 2014-07-28. Score: 3 | Accepted answer

The Craft Categories page is very useful.
To assign an entry to a category, create a category field, and require it in the entry type (you are probably already doing this).
When you create a Category Group you can edit the field layout, and add an image field and a text field for the category. Then to edit that content, double click on the category itself (from the right-side category menu), and you will get a modal dialog where you can edit the text and image.
To list the categories in myCategoryGroup you do:
{% set categories = craft.category.group('myCategoryGroup') %}
{% for cat in categories %}
  {{cat.title}} - {{cat.image}} {# assuming image is the name of the image field #
{% endfor %}

Craft site has an article on How do I list the entries related to a category?.

> **Comments:**
> **username_0**: Thank you! My first issue was not realising there was a "Field Layout" tab on the category group edit page. On top of that I'm not sure I would have noticed you could "double click on the category itself".  

---

