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 %}
            {% 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?

1 Answer 1


The next step is that you would need to chain .relatedTo(restaurant) to your existing craft.entries() call

  • What would be the final snippet for this? I have problems to make it work.
    – Mark H.
    Mar 16, 2019 at 1:04
  • Anonyone please?
    – Mark H.
    Mar 17, 2019 at 18:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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