Let’s say i have a location channel, a studio and a team channel. A location contains one or several studios and a studio contains one or several teams. I can display all the teams in a location by looping through all the studios related to the location and then through all the teams related to the studio.
Is it somehow possible to do that in one loop? To only loop through all the teams related to the location ( which aren’t related directly to each other)?
location/_entry.html :
{% set studios = craft.entries.section('studio').relatedTo(entry) %}
{% block content %}
<article>
<h2>Studios in {{entry.title}}</h2>
{% for studio in studios %}
<h3>{{studio.title}}</h3>
{% endfor %}
<h2>All teams in {{entry.title}}</h2>
{% for studio in studios %}
{% for team in craft.entries.section('team').relatedTo(studio) %}
<h3>{{team.title}}</h3>
{% endfor %}
{% endfor %}
</article>
{% endblock %}