<p>Okey, I already solved it by investigating more.</p>
<p>I made it work with this code:</p>
<pre><code>{% for item in entry.menusItems %}
        
            &lt;li class=&quot;grid-item__li&quot;&gt;

                &lt;div class=&quot;grid-item__category&quot;&gt;

                        {% for category in item.menucategory %}

                            &lt;label class=&quot;item__category--label&quot;&gt;{{ category.title }}&lt;/label&gt;

                        {% endfor %}
                        
                &lt;/div&gt;
</code></pre>

CC BY-SA 4.0
2023-03-16T20:14:52.047Z
Yes! This outputs each menu item, and for each item outputs the categories that are attached to it via the menucategory field on the item. Do note that this will output a category label for every category, if more than one category is selected in that field. Nice job, and don't forget you can mark your own answer as "the accepted answer" to close this out :)
cherrykoda
CC BY-SA 4.0
2023-03-16T19:03:45.503Z
2023-03-16T19:03:45.503Z
mencantalamelva
<p>I have a single page(index) where I'm showing all my items.</p>
<p><a href="https://i.sstatic.net/0j9UW.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/0j9UW.png" alt="enter image description here" /></a></p>
<p>I have the field for setting the category on my item's section so that when I'm on the item page it shows the category of the post.</p>
<p><a href="https://i.sstatic.net/vshUI.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/vshUI.png" alt="enter image description here" /></a></p>
<p>The thing is that I want to show the category of the child (item) on the index page and I'm having troubles as I don't know how to access the category from it from the page before to it.
I mean, on the index page on &quot;Menú barbacoa&quot; I want that it displays on the yellow container it's category, that is &quot;Menu estrella&quot;</p>
<p>For showing the items on the index page, I have a for loop looking like this:</p>
<pre><code>{% for item in entry.menusItems %}
        
            &lt;li class=&quot;grid-item__li&quot;&gt;

                &lt;div class=&quot;grid-item__category&quot;&gt;

                    {% set category = craft.categories.group('menus') %}
                    &lt;label class=&quot;item__category--label&quot;&gt;{{ category.title }}&lt;/label&gt;

                &lt;/div&gt;
</code></pre>
<p>How should I continue?</p>
<p>Many thanks.</p>

CC BY-SA 4.0
2023-03-16T12:31:24.807Z
What is the handle of your category select field?
James Smith
CC BY-SA 4.0
2023-03-16T18:28:35.480Z
The handle is menuCategory @JamesSmith
mencantalamelva
<category>
Show post category on an upper level page
# Show post category on an upper level page

(Asked by: username_0 on 2023-03-15)

I have a single page(index) where I'm showing all my items.

I have the field for setting the category on my item's section so that when I'm on the item page it shows the category of the post.

The thing is that I want to show the category of the child (item) on the index page and I'm having troubles as I don't know how to access the category from it from the page before to it.
I mean, on the index page on "Menú barbacoa" I want that it displays on the yellow container it's category, that is "Menu estrella"
For showing the items on the index page, I have a for loop looking like this:
{% for item in entry.menusItems %}
        
            

                

                    {% set category = craft.categories.group('menus') %}
                    {{ category.title }}

                

How should I continue?
Many thanks.

**Tags:** category

> **Comments:**
> **username_1**: What is the handle of your category select field?  
> **username_0**: The handle is menuCategory @JamesSmith  

---

## 1 answers

### Answer by username_0 on 2023-03-16. Score: 2 | Accepted answer

Okey, I already solved it by investigating more.
I made it work with this code:
{% for item in entry.menusItems %}
        
            

                

                        {% for category in item.menucategory %}

                            {{ category.title }}

                        {% endfor %}

> **Comments:**
> **username_2**: Yes! This outputs each menu item, and for each item outputs the categories that are attached to it via the menucategory field on the item. Do note that this will output a category label for every category, if more than one category is selected in that field. Nice job, and don't forget you can mark your own answer as "the accepted answer" to close this out :)  

---

