// descend only when the depth is right and there are childrens for this element
if ( ($max_depth == 0 || $max_depth > $depth+1 ) && isset( $children_elements[$id]) ) {
- foreach( $children_elements[ $id ] as $child ){
+ foreach ( $children_elements[ $id ] as $child ){
if ( !isset($newlevel) ) {
$newlevel = true;
if ( ( $max_depth == 0 ) && count( $children_elements ) > 0 ) {
$empty_array = array();
foreach ( $children_elements as $orphans )
- foreach( $orphans as $op )
+ foreach ( $orphans as $op )
$this->display_element( $op, $empty_array, 1, 0, $args, $output );
}
if ( $end >= $total_top && count( $children_elements ) > 0 ) {
$empty_array = array();
foreach ( $children_elements as $orphans )
- foreach( $orphans as $op )
+ foreach ( $orphans as $op )
$this->display_element( $op, $empty_array, 1, 0, $args, $output );
}
}
/**
+ * Calculates the total number of root elements.
*
- * @param array $elements
- * @return int
+ * @since 2.7.0
+ * @access public
+ *
+ * @param array $elements Elements to list.
+ * @return int Number of root elements.
*/
public function get_number_of_root_elements( $elements ){
$num = 0;