Skip to content

$pages->count()

Counts all elements

$pages->count(): int

Return type

int

Parent class

Kirby\Cms\Pages inherited from Kirby\Toolkit\Iterator

Example

Counting first level pages

The site has <?= $pages->count() ?> main pages

Counting subpages

This page has <?= $page->children()->count() ?> subpages

Counting all pages

The site has <?= $site->index()->count() ?> pages in total