<p>I've managed to solve it. <code>&lt;span class='nav-item'&gt;&lt;a href="{{ category.counties.first().url }}"&gt;{{ category.counties.first().title }}&lt;/a&gt;&lt;/span&gt;</code> did the trick.</p>

<p>Clearly I just needed to print the category field, although I'm not sure why it needs the <code>.first()</code> after <code>category.counties</code> to print it? But it works at least after days of struggling to find an answer.</p>

CC BY-SA 3.0
2016-12-14T22:50:22.923Z
2016-12-14T22:50:22.923Z
mention79
<p>I have a custom list of breadcrumbs that two of the levels reference different Category Groups. I'm able to get the correct breadcrumb to display for the page that I'm on using <code>category.title</code>, but I need to display the correct category for the previous breadcrumb also.</p>

<p>I've made some progress and have managed to get it to display the first category in the group I want by using <code>{% set county = craft.categories.group('counties').first() %}</code> but I need it to display the category that I've attached to the page with a category field, and not just the first item in the category.</p>

<p>Here's the current code:</p>

<pre><code>{% block breadcrumbs %}
    &lt;div class="full-width breadcrumbs nav-breadcrumbs navbar-fixed-top"&gt;
        &lt;div class='container'&gt;
            &lt;header class='scroll'&gt;
                &lt;span class='nav-item'&gt;&lt;a href="/"&gt;&lt;i class="icon-home"&gt;&lt;/i&gt;&lt;/a&gt;&lt;/span&gt;
                &lt;span class='nav-item'&gt;&lt;a href="/developments"&gt;All Developments&lt;/a&gt;&lt;/span&gt;
                {% set county = craft.categories.group('counties').first() %}
                &lt;span class='nav-item'&gt;&lt;a href="{{ county.url }}"&gt;{{ county.title }}&lt;/a&gt;&lt;/span&gt;
                &lt;span class='nav-item active'&gt;&lt;a href="{{ category.url }}"&gt;{{ category.title }}&lt;/a&gt;&lt;/span&gt;
            &lt;/header&gt;
        &lt;/div&gt;
    &lt;/div&gt;
{% endblock %}
</code></pre>

<categories>
Display different Categories groups in custom breadcrumbs
# Display different Categories groups in custom breadcrumbs

(Asked by: username_0 on 2016-12-13)

I have a custom list of breadcrumbs that two of the levels reference different Category Groups. I'm able to get the correct breadcrumb to display for the page that I'm on using category.title, but I need to display the correct category for the previous breadcrumb also.
I've made some progress and have managed to get it to display the first category in the group I want by using {% set county = craft.categories.group('counties').first() %} but I need it to display the category that I've attached to the page with a category field, and not just the first item in the category.
Here's the current code:
{% block breadcrumbs %}
    
        
            
                
                All Developments
                {% set county = craft.categories.group('counties').first() %}
                {{ county.title }}
                {{ category.title }}
            
        
    
{% endblock %}

**Tags:** categories

---

## 1 answers

### Answer by username_0 on 2016-12-14. Score: 2

I've managed to solve it. `{{ category.counties.first().title }}` did the trick.

Clearly I just needed to print the category field, although I'm not sure why it needs the `.first()` after `category.counties` to print it? But it works at least after days of struggling to find an answer.


---

