Answers.Body: <p>aah</p>
  
  <pre><code>{% for category in entry.productCategory %}
      {{ category.title }} &gt;
  {% endfor %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-10-16T17:00:38.357Z
Answers.Text: now to highlight the nested category!
Answers.UserDisplayName: user2569
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-10-17T11:15:02.173Z
Answers.Text: Is there a way to make a nested category active?
Answers.UserDisplayName: user2569
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-10-17T11:15:44.257Z
Answers.Text: the entry category field value is:
  
  Transformers  
  > Standard Fixed Installation Transformers  
  > Wall/floor mounting Transformers 1-10KVA
Answers.UserDisplayName: user2569
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-10-17T11:17:34.080Z
Answers.Text: I want make 'Wall/floor mounting Transformers 1-10KVA' active
Answers.UserDisplayName: user2569
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-10-17T11:42:32.387Z
Answers.Text: so I need a way to dynamically detect what level the nested category is: rather than this static approach:
  
  
  ```<ul>
      {% nav category in entry.productCategory %}
          <li>
           {% if category.level == 1 %}
             {{ category.title }}         
          </li>
          {% endif %}
  
          {% if category.level == 2 %}
          {{ category.title }}
          {% endif %}
  
            {% if category.level == 3 %}
          <a href="{{ category.url }}">{{ category.title }}</a>
          {% endif %}
      {% endnav %}
  </ul>```
Answers.UserDisplayName: user2569
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-10-16T16:59:08.313Z
Answers.LastActivityDate: 2019-10-16T16:59:08.313Z
Answers.UserDisplayName: user2569
Body: <p>I have an entry which has a category field 'productCategory' and the chosen category is a nested one (3 deep), I want to output the category and where it's nested, but by using the field's name: <code>{{ entry.productCategory.one() }}</code> I get the parent category only, because of <code>.one()</code> I guess, if I use without <code>.one()</code>, then I get a tonne of queries displayed, so I'm not sure how to even approach displaying the actual nested category like a breadcrumb trail. I can display the categories as a nested navigation, but for now I want the entry's chosen category, any ideas? Thanks</p>
  
Tags: <category>
Title: Display nested category
ThreadText: # Display nested category
  
  (Asked by: username_0 on 2019-10-16)
  
  I have an entry which has a category field 'productCategory' and the chosen category is a nested one (3 deep), I want to output the category and where it's nested, but by using the field's name: `{{ entry.productCategory.one() }}` I get the parent category only, because of `.one()` I guess, if I use without `.one()`, then I get a tonne of queries displayed, so I'm not sure how to even approach displaying the actual nested category like a breadcrumb trail. I can display the categories as a nested navigation, but for now I want the entry's chosen category, any ideas? Thanks
  
  **Tags:** category
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2019-10-16. Score: 1
  
  aah
  
  ```
  {% for category in entry.productCategory %}
      {{ category.title }} >
  {% endfor %}
  
  ```
  
  > **Comments:**
  > **username_0**: now to highlight the nested category!  
  > **username_0**: Is there a way to make a nested category active?  
  > **username_0**: the entry category field value is:  Transformers   > Standard Fixed Installation Transformers   > Wall/floor mounting Transformers 1-10KVA  
  > **username_0**: I want make 'Wall/floor mounting Transformers 1-10KVA' active  
  > **username_0**: so I need a way to dynamically detect what level the nested category is: rather than this static approach:   ```<ul>     {% nav category in entry.productCategory %}         <li>          {% if category.level == 1 %}            {{ category.title }}                  </li>         {% endif %}          {% if category.level == 2 %}         {{ category.title }}         {% endif %}            {% if category.level == 3 %}         <a href="{{ category.url }}">{{ category.title }}</a>         {% endif %}     {% endnav %} </ul>```  
  
  ---
  
  