Answers.Body: <p>Of course after posting my question I immediately <a href="https://craftcms.stackexchange.com/questions/718/how-do-you-only-show-children-of-active-parent-using-categories">find an answer</a>!!!</p>
  
  <p>Would be good if someone can confirm this is the best way?</p>
  
  <pre><code>      {% set categories = craft.categories.group('areaOfPractice') %}
          {% for category in categories %}
            {% set thisIsActiveCategory = (category.slug == craft.request.segment(2)) %}
              {% if thisIsActiveCategory %}
                {% set subCategories = craft.categories.descendantOf(category) %}
                &lt;ul&gt;
                  {% for subCat in subCategories %}
                  &lt;li&gt;&lt;a href="{{ subCat.url }}"&gt;{{ subCat.title }}&lt;/a&gt;&lt;/li&gt;
                  {% endfor %}
                &lt;/ul&gt;
              {% endif %}
          {% endfor %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-29T14:11:51.727Z
Answers.LastActivityDate: 2015-08-29T14:11:51.727Z
Answers.LastEditDate: 2017-04-13T12:51:00.160Z
Answers.UserDisplayName: Martin
Answers.Body: <p>You should actually already have a variable named "category"
  pre-assigned by Craft, if you've set up your categories to have URLs in the category settings.</p>
  
  <p>So this simplified code is probably all you need.</p>
  
  <pre><code>{% set subCategories = craft.categories.descendantOf(category) %}
  
  {% if subCategories|length %}
      &lt;ul&gt;
          {% for category in subCategories %}
              &lt;li&gt;&lt;a href="{{ category.url }}"&gt;{{ category.title }}&lt;/a&gt;&lt;/li&gt;
          {% endfor %}
      &lt;/ul&gt;
  {% else %}
      {% exit 404 %}    
  {% endif %}
  </code></pre>
  
  <p>To have different template code for your sub-category pages you're linking to, I would
  put the code above in a partial _partials/mainCategory and include it with the <code>include</code> function.</p>
  
  <pre><code>{% if category.level == 1 %}
      {% include '_partials/mainCategory' %}
  {% else %}
      {% include '_partials/subCategory' %}
  {% endif %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-29T18:59:06.420Z
Answers.LastActivityDate: 2015-08-29T18:59:06.420Z
Answers.UserDisplayName: carlcs
Body: <p>I have a category group with parents each with 1 level of children.</p>
  
  <p>On my category entry page I want to list JUST the children of the current category being viewed.</p>
  
  <p>I'm sure it's simple but I can't figure what to put in my category template?</p>
  
  <p>Many thanks in advance.</p>
  
  <p>Martin</p>
  
Tags: <categories>
Title: Showing just the child category titles of a parent
ThreadText: # Showing just the child category titles of a parent
  
  (Asked by: username_0 on 2015-08-29)
  
  I have a category group with parents each with 1 level of children.
  
  On my category entry page I want to list JUST the children of the current category being viewed.
  
  I'm sure it's simple but I can't figure what to put in my category template?
  
  Many thanks in advance.
  
  username_0
  
  **Tags:** categories
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2015-08-29. Score: 5 | Accepted answer
  
  You should actually already have a variable named "category"
  pre-assigned by Craft, if you've set up your categories to have URLs in the category settings.
  
  So this simplified code is probably all you need.
  
  ```
  {% set subCategories = craft.categories.descendantOf(category) %}
  
  {% if subCategories|length %}
      <ul>
          {% for category in subCategories %}
              <li><a href="{{ category.url }}">{{ category.title }}</a></li>
          {% endfor %}
      </ul>
  {% else %}
      {% exit 404 %}    
  {% endif %}
  
  ```
  
  To have different template code for your sub-category pages you're linking to, I would
  put the code above in a partial \_partials/mainCategory and include it with the `include` function.
  
  ```
  {% if category.level == 1 %}
      {% include '_partials/mainCategory' %}
  {% else %}
      {% include '_partials/subCategory' %}
  {% endif %}
  
  ```
  
  
  ---
  
  ### Answer by username_0 on 2015-08-29. Score: 1
  
  Of course after posting my question I immediately [find an answer](https://craftcms.stackexchange.com/questions/718/how-do-you-only-show-children-of-active-parent-using-categories)!!!
  
  Would be good if someone can confirm this is the best way?
  
  ```
        {% set categories = craft.categories.group('areaOfPractice') %}
          {% for category in categories %}
            {% set thisIsActiveCategory = (category.slug == craft.request.segment(2)) %}
              {% if thisIsActiveCategory %}
                {% set subCategories = craft.categories.descendantOf(category) %}
                <ul>
                  {% for subCat in subCategories %}
                  <li><a href="{{ subCat.url }}">{{ subCat.title }}</a></li>
                  {% endfor %}
                </ul>
              {% endif %}
          {% endfor %}
  
  ```
  
  
  ---
  
  