Walker::get_number_of_root_elements( array $elements )
Calculates the total number of root elements.
Description Description
Parameters Parameters
- $elements
-
(array) (Required) Elements to list.
Return Return
(int) Number of root elements.
Source Source
File: wp-includes/class-wp-walker.php
public function get_number_of_root_elements( $elements ) { $num = 0; $parent_field = $this->db_fields['parent']; foreach ( $elements as $e ) { if ( 0 == $e->$parent_field ) { $num++; } } return $num; }
Expand full source code Collapse full source code View on Trac
Changelog Changelog
Version | Description |
---|---|
2.7.0 | Introduced. |