loop through an entry's "related entries", grouped by category Hope somebody can help us with this: 

Objective: loop through a given Entry's "Related Entries" entry field and output the results - but group the results by the category to which they belong - not just a straight splurge of related entries.

Where we are:

{% for category in categories %}
&lt;h2&gt;{{ category.title }}&lt;/h2&gt;{# spit out the Category #}

{% for relatedEntry in entry.relatedEntries %}
    {{ relatedEntry.title }}{# this spits out all entries, but ignores whether the entry is related to the current category #}

    {# So, try and check if it's related to the current category... #}
    {% if relatedEntry.relatedTo(category) %}{# Trying to use this throws "Craft\EntryModel and its behaviors do not have a method or closure named "relatedTo"." #}
        &lt;p&gt;{{ relatedEntry.title }}&lt;/p&gt;
    {% endif %}
{% endfor %}
{% endfor %}
Try this:

{% for category in categories %}
    &lt;h2&gt;{{ category.title }}&lt;/h2&gt;{# spit out the Category #}

    {% set entries = craft.entries.section('news').relatedTo(category) %}
    {% for relatedEntry in entries %}
        {{ relatedEntry.title }}
    {% endfor %}
{% endfor %}


See the set entries = ... line.

I am retrieving the entries that are related to each category as it loops thru each category.