Answers.Body: <p>What you want is the categories that do not have descendants. I would loop over all the categories, and skip the ones with descendants. The test to skip is:</p>
  
  <pre><code>{% if not category.hasDescendants %} ... {% endif %}
  </code></pre>
  
  <p>Documentation for <a href="https://craftcms.com/docs/templating/categorymodel#hasDescendants" rel="nofollow noreferrer">hasDescendants</a>.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-19T07:33:09.437Z
Answers.Text: Phantastic! That does the trick! Very cool! Thank you very much Marion!
Answers.UserDisplayName: analog junkie
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-18T18:28:26.380Z
Answers.LastActivityDate: 2018-01-18T18:28:26.380Z
Answers.UserDisplayName: Marion Newlevant
Body: <p>I have an issue with categories with different levels:</p>
  
  <p>I have a group of categories which have a structure like this:</p>
  
  <p>First form:
  1.0 Group –
  1.1 Subgroup –
  1.2 Items in subgroup</p>
  
  <p>Second form:
   - 1.0 Group –
     1.1 Items in Group</p>
  
  <p>In some groups are subgroups in others aren't. But I need to list all the items, regardless if they are in a subgroup or not. How can I adress them correctly. Can I do an if statement like: if there is no 1.2 level, take the 1.1 level and treat it like a 1.2 level?</p>
  
  <p>How can I do this?</p>
  
Tags: <categories>
Title: Entries from different category levels brought together
ThreadText: # Entries from different category levels brought together
  
  (Asked by: username_0 on 2018-01-18)
  
  I have an issue with categories with different levels:
  
  I have a group of categories which have a structure like this:
  
  First form:
  1.0 Group –
  1.1 Subgroup –
  1.2 Items in subgroup
  
  Second form:
  - 1.0 Group –
  1.1 Items in Group
  
  In some groups are subgroups in others aren't. But I need to list all the items, regardless if they are in a subgroup or not. How can I adress them correctly. Can I do an if statement like: if there is no 1.2 level, take the 1.1 level and treat it like a 1.2 level?
  
  How can I do this?
  
  **Tags:** categories
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-01-18. Score: 2 | Accepted answer
  
  What you want is the categories that do not have descendants. I would loop over all the categories, and skip the ones with descendants. The test to skip is:
  
  ```
  {% if not category.hasDescendants %} ... {% endif %}
  
  ```
  
  Documentation for [hasDescendants](https://craftcms.com/docs/templating/categorymodel#hasDescendants).
  
  > **Comments:**
  > **username_0**: Phantastic! That does the trick! Very cool! Thank you very much username_1!  
  
  ---
  
  