PageTraversal::numDescendants()

Return number of descendants, optionally with conditions

Use this over $page->numDescendants property when you want to specify a selector or when you want the result to include only visible descendants. See the options for the $selector argument.

Usage

// basic usage
$int = $pageTraversal->numDescendants(Page $page);

// usage with all arguments
$int = $pageTraversal->numDescendants(Page $page, $selector = null);

Arguments

NameType(s)Description
$pagePage
$selector (optional)

Return value

int

Number of descendants


PageTraversal methods and properties

API reference based on ProcessWire core version 3.0.255