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.

1 Answer 1


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 %}
            <li>{{ category.title }}</li>
        {% endif %}
{% endif %}

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.