<p>If you want all the descendent too you can use:</p>

<pre><code>{% set totalDescendents = entry.getDescendants().count() %}
</code></pre>

<p><a href="https://buildwithcraft.com/docs/templating/entrymodel#getDescendants" rel="nofollow">https://buildwithcraft.com/docs/templating/entrymodel#getDescendants</a></p>

CC BY-SA 3.0
2015-08-17T02:35:15.037Z
2015-08-17T02:35:15.037Z
j00lz
<p>You could get the number of direct children using this:</p>

<pre><code>{% set numChildren = entry.children().count() %}
</code></pre>

<p>I'm not sure if there's an efficient solution to getting the full number of children, grandchildren etc. without just comparing against the URL which seems like a workaround.</p>

CC BY-SA 3.0
2015-08-16T20:39:29.583Z
2015-08-17T14:18:56.443Z
2015-08-17T14:18:56.443Z
Rick
<p>In my template I'm displaying all entries of a structure: ('areas').level(1) using a loop.</p>

<p>I would also like to display the number of children entries in each of the 'areas'.</p>

<p>Like: "Area 1, 4 properties", "Area 2, 7 properties", "Area 3, 5 properties" and so on.</p>

<p>Anyone?</p>

<structure><children>
Output number of children in a structure
# Output number of children in a structure

(Asked by: username_0 on 2015-08-16)

In my template I'm displaying all entries of a structure: ('areas').level(1) using a loop.

I would also like to display the number of children entries in each of the 'areas'.

Like: "Area 1, 4 properties", "Area 2, 7 properties", "Area 3, 5 properties" and so on.

Anyone?

**Tags:** structure, children

---

## 2 answers

### Answer by username_1 on 2015-08-17. Score: 2

If you want all the descendent too you can use:
{% set totalDescendents = entry.getDescendants().count() %}

https://buildwithcraft.com/docs/templating/entrymodel#getDescendants


---

### Answer by username_2 on 2015-08-16. Score: 1

You could get the number of direct children using this:
{% set numChildren = entry.children().count() %}

I'm not sure if there's an efficient solution to getting the full number of children, grandchildren etc. without just comparing against the URL which seems like a workaround.


---

