Used By
Used By | Description |
---|---|
wp-includes/comment.php: get_comment_pages_count() | Calculate the total number of comment pages. |
Calculates the total number of root elements.
(array) (Required) Elements to list.
(int) Number of root elements.
Counts the number of top-level items (no children or descendants) in the provided array, and returns that count.
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; }
Version | Description |
---|---|
2.7.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/walker/get_number_of_root_elements