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.



If you want all the descendent too you can use:

{% set totalDescendents = entry.getDescendants().count() %}



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.

This site is temporarily in read only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .