<p>This will list all the categories that are assigned to the entry regardless of level.</p>

<pre><code>&lt;ul&gt;
    {% for category in entry.categoriesFieldHandle %}
        &lt;li&gt;&lt;a href="{{ category.url }}"&gt;category.title&lt;/a&gt;&lt;/li&gt;
    {% endfor %}
&lt;/ul&gt;
</code></pre>

<p>If you only want to list the subcategories, (regardless of whether a main category is also assigned) then you can add a test for the category level.</p>

<pre><code>&lt;ul&gt;
    {% for category in entry.categoriesFieldHandle %}
        {% if category.level &gt; 1 %}
            &lt;li&gt;&lt;a href="{{ category.url }}"&gt;category.title&lt;/a&gt;&lt;/li&gt;
        {% endif %}
    {% endfor %}
&lt;/ul&gt;
</code></pre>

CC BY-SA 3.0
2015-01-23T12:36:01.767Z
I would actually include the level argument in the for loop. That field is just an element criteria model until you actually run it. Something like this: `{% for category in entry.categoriesFieldHandle.level(1) %}`
Bryan Redeagle
CC BY-SA 3.0
2015-01-23T15:25:12.797Z
Beautiful! Thanks to both of you :^) I combined your methods (changing level(1) to level('> 1') to get sub-categories in the loop) and it works a charm!
Dan Owen
CC BY-SA 3.0
2015-01-23T17:09:10.120Z
Great! That works too. I wasn't sure if you maybe wanted to something slightly different with each level.
Douglas McDonald
CC BY-SA 3.0
2015-01-23T00:01:49.927Z
2015-01-23T00:01:49.927Z
Douglas McDonald
<p>I'm new to all of this and so far Categories from a templating point of view are confusing me a bit. I'm loving Craft so far but some concepts are causing me some headaches to adjust to!</p>

<p>What i'm trying to do is list the sub-categories a blog post is part of.</p>

<p>I have 6 categories and each has 4 sub-categories.
I only want to list the sub-categories.</p>

<p>So when someone is viewing the site and they click into a full blog post page, at the top i'm listing the title, author, posted date and i want to follow that with a lisrt of the sub-categories applied to that blog post.</p>

<categories>
List the categories an entry is part of?
# List the categories an entry is part of?

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

I'm new to all of this and so far Categories from a templating point of view are confusing me a bit. I'm loving Craft so far but some concepts are causing me some headaches to adjust to!

What i'm trying to do is list the sub-categories a blog post is part of.

I have 6 categories and each has 4 sub-categories.
I only want to list the sub-categories.

So when someone is viewing the site and they click into a full blog post page, at the top i'm listing the title, author, posted date and i want to follow that with a lisrt of the sub-categories applied to that blog post.

**Tags:** categories

---

## 1 answers

### Answer by username_1 on 2015-01-23. Score: 5 | Accepted answer

This will list all the categories that are assigned to the entry regardless of level.

    {% for category in entry.categoriesFieldHandle %}
        category.title
    {% endfor %}


If you only want to list the subcategories, (regardless of whether a main category is also assigned) then you can add a test for the category level.

    {% for category in entry.categoriesFieldHandle %}
        {% if category.level > 1 %}
            category.title
        {% endif %}
    {% endfor %}

> **Comments:**
> **username_2**: I would actually include the level argument in the for loop. That field is just an element criteria model until you actually run it. Something like this: `{% for category in entry.categoriesFieldHandle.level(1) %}`  
> **username_0**: Beautiful! Thanks to both of you :^) I combined your methods (changing level(1) to level('> 1') to get sub-categories in the loop) and it works a charm!  
> **username_1**: Great! That works too. I wasn't sure if you maybe wanted to something slightly different with each level.  

---

