<p>Without knowing what your field handles are, this is the gist of how you’d do it:</p>

<pre><code>{#
   Loop through each block within your Matrix field,
   assigning them to a `block` variable:
#}

{% for block in entry.myMatrixField %}

    {#
       Loop through each category within this Matrix block,
       assigning them to a `category` variable:
    #}

    {% for category in block.myCategoriesField %}

        {#
           Output the plain text field value:
        #}

        &lt;p&gt;{{ category.myPlainTextField }}&lt;/p&gt;

    {% endfor %}

{% endfor %}
</code></pre>

CC BY-SA 3.0
2015-01-06T11:38:55.100Z
2015-01-06T11:38:55.100Z
Brandon Kelly
<p>I'm new to craft so this is a bit newbie question.</p>

<p>I have a category group with a set of categories, each category has a plain text field associated with it. The category group is then used as a field in a Matrix so the user can select one of the categories in the group. Basically all I want to do is list the plain text field from the selected category onto the page. </p>

<p>I tried working something out from <a href="https://craftcms.com/docs/relations" rel="nofollow noreferrer">https://craftcms.com/docs/relations</a> (Going through a matrix section) but I just kept breaking everything. Any assistance would be appreciated!</p>

<p>Thanks.</p>

<matrix><categories>
How do I output the value of a field from a Category selected from a Matrix?
# How do I output the value of a field from a Category selected from a Matrix?

(Asked by: username_0 on 2015-01-06)

I'm new to craft so this is a bit newbie question.

I have a category group with a set of categories, each category has a plain text field associated with it. The category group is then used as a field in a Matrix so the user can select one of the categories in the group. Basically all I want to do is list the plain text field from the selected category onto the page.

I tried working something out from <https://craftcms.com/docs/relations> (Going through a matrix section) but I just kept breaking everything. Any assistance would be appreciated!

Thanks.

**Tags:** matrix, categories


---

## 1 answers

### Answer by username_1 on 2015-01-06. Score: 2 | Accepted answer

Without knowing what your field handles are, this is the gist of how you’d do it:
{#
   Loop through each block within your Matrix field,
   assigning them to a `block` variable:
#}

{% for block in entry.myMatrixField %}

    {#
       Loop through each category within this Matrix block,
       assigning them to a `category` variable:
    #}

    {% for category in block.myCategoriesField %}

        {#
           Output the plain text field value:
        #}

        {{ category.myPlainTextField }}

    {% endfor %}

{% endfor %}


---

