Answers.Body: <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>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-17T02:35:15.037Z
Answers.LastActivityDate: 2015-08-17T02:35:15.037Z
Answers.UserDisplayName: j00lz
Answers.Body: <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>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-16T20:39:29.583Z
Answers.LastActivityDate: 2015-08-17T14:18:56.443Z
Answers.LastEditDate: 2015-08-17T14:18:56.443Z
Answers.UserDisplayName: Rick
Body: <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>
  
Tags: <structure><children>
Title: Output number of children in a structure
ThreadText: # 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.
  
  
  ---
  
  