Walker::get_number_of_root_elements()
最后更新于:2021-11-26 05:25:20
Walker::get_number_of_root_elements( array$elements)Calculates the total number of root elements.
参数
- $elements
-
(array) (Required) Elements to list.
响应
(int) Number of root elements.
源文件
文件: gc-includes/class-gc-walker.php
public function get_number_of_root_elements( $elements ) {
$num = 0;
$parent_field = $this->db_fields['parent'];
foreach ( $elements as $e ) {
if ( empty( $e->$parent_field ) ) {
$num++;
}
}
return $num;
}