<p>If you have a <a href="https://craftcms.com/docs/categories-fields" rel="nofollow">Categories field</a> on your entry called <code>myCategoryField</code>, you can check if it has any Categories selected by going:</p>

<pre><code>{% if entry.myCategoryField | length %}
    There are categories selected!
{% endif %}
</code></pre>

<p>If you want to loop through all of the selected categories for that field, you can do:</p>

<pre><code>{% if entry.myCategoryField | length %}
    &lt;ul&gt;
        {% for category in entry.myCategoryField %}
            &lt;li&gt;{{ category.title }}&lt;/li&gt;
        {% endif %}
    &lt;/ul&gt;
{% endif %}
</code></pre>

<p>For more info you can read more in the <a href="https://craftcms.com/docs/categories-fields#templating" rel="nofollow">templating section</a> of the Categories field's documentation.</p>

CC BY-SA 3.0
2016-08-12T03:21:30.393Z
2016-08-12T03:21:30.393Z
Brad Bell
<p>I'm building my first site with Craft, so this is a bit newbie question.</p>

<p>I've build a category with a some fields.
How can I output all fields form the selected category on the current entry?</p>

<p>Thank you very much.</p>

<category>
How do I output all field values from a Category on the current entry?
# How do I output all field values from a Category on the current entry?

(Asked by: username_0 on 2016-08-12)

I'm building my first site with Craft, so this is a bit newbie question.

I've build a category with a some fields.
How can I output all fields form the selected category on the current entry?

Thank you very much.

**Tags:** category


---

## 1 answers

### Answer by username_1 on 2016-08-12. Score: 2

If you have a Categories field on your entry called myCategoryField, you can check if it has any Categories selected by going:
{% if entry.myCategoryField | length %}
    There are categories selected!
{% endif %}

If you want to loop through all of the selected categories for that field, you can do:
{% if entry.myCategoryField | length %}
    
        {% for category in entry.myCategoryField %}
            {{ category.title }}
        {% endif %}
    
{% endif %}

For more info you can read more in the templating section of the Categories field's documentation.


---

