Answers.Body: <p>The next step is that you would need to chain <code>.relatedTo(restaurant)</code> to your existing <code>craft.entries()</code> call</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-03-16T01:04:59.383Z
Answers.Text: What would be the final snippet for this? I have problems to make it work.
Answers.UserDisplayName: Mark H.
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-03-17T18:11:08.980Z
Answers.Text: Anonyone please?
Answers.UserDisplayName: Mark H.
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-03-15T14:28:11.340Z
Answers.LastActivityDate: 2019-03-15T14:28:11.340Z
Answers.UserDisplayName: Yuri Salimovskiy
Body: <p>What's given:</p>
  
  <pre><code>Channel: Nutrition
  Entries Fieldtype: restaurant
  Category Fieldtype : menu
  
  Category: Menu
  
  Channel: Menus that also use relations using restaurant field.
  </code></pre>
  
  <p>Each item in the nutrition channel has restaurant and menu category selected.</p>
  
  <p>On a restaurant's menu page I'm trying to list menu items from the nutrition channel grouped by categories.</p>
  
  <p>Currently I use the following snippet</p>
  
  <pre><code>            {% for category in craft.categories.group('menu').all() %}
                  &lt;h3 id="{{ category.slug }}"&gt;{{ category.title }}&lt;/h2&gt;
                  &lt;ul class="menu-items"&gt;
                      {% for entry in craft.entries.section('nutrition').relatedTo(category).orderBy('title').all() %}
                          &lt;li&gt;&lt;a href="{{ entry.url }}"&gt;{{ entry.title }}&lt;/a&gt;&lt;/li&gt;
                      {% endfor %}
                  &lt;/ul&gt;
              {% endfor %}
  </code></pre>
  
  <p>Which works fine. However if I add more nutrition items and assign them to another restaurant they'll be listed as well.</p>
  
  <p>I assume we need to define restaurant first</p>
  
  <pre><code>{% set restaurant = craft.entries.section('restaurant').one() %}
  </code></pre>
  
  <p>but what are my next steps?</p>
  
Tags: <categories><relations>
Title: Relations and Categories
ThreadText: # Relations and Categories
  
  (Asked by: username_0 on 2019-03-14)
  
  What's given:
  
  ```
  Channel: Nutrition
  Entries Fieldtype: restaurant
  Category Fieldtype : menu
  
  Category: Menu
  
  Channel: Menus that also use relations using restaurant field.
  
  ```
  
  Each item in the nutrition channel has restaurant and menu category selected.
  
  On a restaurant's menu page I'm trying to list menu items from the nutrition channel grouped by categories.
  
  Currently I use the following snippet
  
  ```
              {% for category in craft.categories.group('menu').all() %}
                  <h3 id="{{ category.slug }}">{{ category.title }}</h2>
                  <ul class="menu-items">
                      {% for entry in craft.entries.section('nutrition').relatedTo(category).orderBy('title').all() %}
                          <li><a href="{{ entry.url }}">{{ entry.title }}</a></li>
                      {% endfor %}
                  </ul>
              {% endfor %}
  
  ```
  
  Which works fine. However if I add more nutrition items and assign them to another restaurant they'll be listed as well.
  
  I assume we need to define restaurant first
  
  ```
  {% set restaurant = craft.entries.section('restaurant').one() %}
  
  ```
  
  but what are my next steps?
  
  **Tags:** categories, relations
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-03-15. Score: 1
  
  The next step is that you would need to chain `.relatedTo(restaurant)` to your existing `craft.entries()` call
  
  > **Comments:**
  > **username_0**: What would be the final snippet for this? I have problems to make it work.  
  > **username_0**: Anonyone please?  
  
  ---
  
  