<p>Personally I would set the category select field outside of the matrix block but that's up to you. 
The problem you are running in to at the moment is you are not looping over the matrix field.</p>

<pre><code>{% for entry in craft.entries.section('job') %}
    {% for block in entry.matrixFieldName if block.type == 'job' %}
        {% for category in block.category %}
            &lt;h2&gt;{{category.title}}&lt;/h2&gt;
        {% endfor %}
        &lt;a href="{{ entry.url }}"&gt;{{ block.title }}&lt;/a&gt;&lt;br&gt;
    {% endfor %}
{% endfor %}
</code></pre>

<p>So what we are doing here in the first loop we dive into the jobs section.</p>

<pre><code>{% for entry in craft.entries.section('job') %}
</code></pre>

<p>Once we are inside a job entry we loop over the matrix field containing the "job" block. We only want to display the "job" block (security for when you add more blocks in the future). </p>

<pre><code>{% for block in entry.matrixFieldName if block.type == 'job' %}
</code></pre>

<p>Once we get into the matrix field we loop over the selected category field. This way you get access to all the fields inside that category (including the title).</p>

<pre><code>{% for category in block.category %}
</code></pre>

<p>Now you have access to all the fields. 
All the fields you want to use from the jobs entry you can grab by {{ entry.field }}. All the fields inside the matrix block by {{ block.field }}. And everything inside the category by {{ category.field }}.</p>

<p><strong>OLD ANSWER</strong></p>

<p>Correct me if I get you wrong.</p>

<p>I guess you have a field that connects an entry to a category but what you could try is something like this: </p>

<pre><code>{% for entry in craft.entries.section('jobs') %}
    {% for category in entry.CATEGORYFIELD %}
         &lt;h2&gt;{{category.title}}&lt;/h2&gt;
    {% endfor %}
     &lt;a href="{{entry.url}}"&gt;{{entry.title}}&lt;/a&gt;&lt;br&gt;
{% endfor %}
</code></pre>

<p>This is if the order doesn't matter.</p>

CC BY-SA 3.0
2017-06-13T13:36:10.550Z
I have a matrix field which holds the category for the entry. The user then sets this when creating the entry. The matrix block type is called jobs and the field is called category. Is this what you mean?
FEDev
CC BY-SA 3.0
2017-06-13T14:21:28.193Z
@DannyT So you dont actually make another entry. You just add another matrix block and connect the matrix blocks to a category instead of an entire entry. If that's the case you I can setup an better answer for you. Do you minde posting a picture of the page inside the CMS?
Justin Dekkers
CC BY-SA 3.0
2017-06-13T14:24:55.720Z
Not exactly. I have a section set up called "jobs" and a field which is a matrix called "job" everytime i want a new job i create an entry inside the jobs channel and add the matrix block job inside that entry. I hope that makes sense.
FEDev
CC BY-SA 3.0
2017-06-13T15:06:09.977Z
@DannyT I've updated the answer
Justin Dekkers
CC BY-SA 3.0
2017-06-13T15:53:09.413Z
how would i go about only display the relevant title and entry for each category page.

For example 
/jobCat/industry would only show industry entries
/jobCat/chemical would only show chemical entries

I've managed to do it using the slug but it doesn't feel as scalable as I would like.
FEDev
CC BY-SA 3.0
2017-06-13T17:15:21.193Z
@DannyT that’s exactly the reason why you’d be better off assigning the categories field directly to the entry.
carlcs
CC BY-SA 3.0
2017-06-13T13:02:26.910Z
2017-06-13T15:05:21.393Z
2017-06-13T15:05:21.393Z
Justin Dekkers
<p>I am trying to create a category template that shows all entries to show relating to the categories. </p>

<p>At the minute the cats are</p>

<ol>
<li>Industry </li>
<li>Chemical</li>
<li>Medical</li>
</ol>

<entries><categories><category><filtering>
Only show entries related to category
# Only show entries related to category

(Asked by: username_0 on 2017-06-13)

I am trying to create a category template that shows all entries to show relating to the categories.

At the minute the cats are

1. Industry
2. Chemical
3. Medical

**Tags:** entries, categories, category, filtering


---

## 1 answers

### Answer by username_1 on 2017-06-13. Score: 3 | Accepted answer

Personally I would set the category select field outside of the matrix block but that's up to you. 
The problem you are running in to at the moment is you are not looping over the matrix field.
{% for entry in craft.entries.section('job') %}
    {% for block in entry.matrixFieldName if block.type == 'job' %}
        {% for category in block.category %}
            {{category.title}}
        {% endfor %}
        {{ block.title }}
    {% endfor %}
{% endfor %}

So what we are doing here in the first loop we dive into the jobs section.
{% for entry in craft.entries.section('job') %}

Once we are inside a job entry we loop over the matrix field containing the "job" block. We only want to display the "job" block (security for when you add more blocks in the future). 
{% for block in entry.matrixFieldName if block.type == 'job' %}

Once we get into the matrix field we loop over the selected category field. This way you get access to all the fields inside that category (including the title).
{% for category in block.category %}

Now you have access to all the fields. 
All the fields you want to use from the jobs entry you can grab by {{ entry.field }}. All the fields inside the matrix block by {{ block.field }}. And everything inside the category by {{ category.field }}.
OLD ANSWER
Correct me if I get you wrong.
I guess you have a field that connects an entry to a category but what you could try is something like this: 
{% for entry in craft.entries.section('jobs') %}
    {% for category in entry.CATEGORYFIELD %}
         {{category.title}}
    {% endfor %}
     {{entry.title}}
{% endfor %}

This is if the order doesn't matter.

> **Comments:**
> **username_0**: I have a matrix field which holds the category for the entry. The user then sets this when creating the entry. The matrix block type is called jobs and the field is called category. Is this what you mean?  
> **username_1**: @DannyT So you dont actually make another entry. You just add another matrix block and connect the matrix blocks to a category instead of an entire entry. If that's the case you I can setup an better answer for you. Do you minde posting a picture of the page inside the CMS?  
> **username_0**: Not exactly. I have a section set up called "jobs" and a field which is a matrix called "job" everytime i want a new job i create an entry inside the jobs channel and add the matrix block job inside that entry. I hope that makes sense.  
> **username_1**: @DannyT I've updated the answer  
> **username_0**: how would i go about only display the relevant title and entry for each category page.  For example  /jobCat/industry would only show industry entries /jobCat/chemical would only show chemical entries  I've managed to do it using the slug but it doesn't feel as scalable as I would like.  
> **username_2**: @DannyT that’s exactly the reason why you’d be better off assigning the categories field directly to the entry.  

---

