I am trying to pull channel entries and display them using a loop. These entries would then be organized by the category they are assigned to based on a categoryfield a user selects when creating the entry. Below is the code I am beginning with.

{% set category = entry.myCategoriesField.first() %}
{% if category %}
 {% for car in craft.entries.section('category')%}
  **Might need a set option here for entries??**


{% endif %}

Should look like:


  • Prius: {{Description}}


  • Ram {{Description}}
  • Silverado{{Description}}


  • Suburban {{Description}}
  • Escape {{Description}}

Any thoughts or direction would be helpful.

I have looked into the following code but don't think it would work the way I want to.

{% set category = entry.myCategoriesField.first() %}
{% if category %}
{% endif %} 

1 Answer 1


Have part of the solution which is to use:

{% set categories = entry.categoriesFieldHandle %}
{% if categories | length %}

<h3>Some great categories</h3>
{% nav category in categories %}
    {%for entry%}

{% endnav %}
{% endif %}

Just now need to find out how to add the Category Title in and work on separating the entries out.

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.