library/Helper/NavigationTree.php
protected function walk($pages, $depth = 1, $classes = null)
    {
        $this->currentDepth = $depth;

        if ($this->args['sublevel']) {
            $this->startWrapper($classes, $depth === 1);
        }

        if (!is_array($pages)) {
            return;
        }

        foreach ($pages as $page) {
            $pageId = $this->getPageId($page);
            $attributes = array();
            $attributes['class'] = array();
            $output = true;

            if (is_numeric($page)) {
                $page = get_post($page);
            }

            if ($this->isAncestors($pageId)) {
                $attributes['class'][] = 'current-node current-menu-ancestor';

                if (count($this->getChildren($pageId)) > 0) {
                    $attributes['class'][] = 'is-expanded';
                }
            }

            if ($this->getPageId($this->currentPage) == $pageId) {
                $attributes['class'][] = 'current current-menu-item';
                if (count($this->getChildren($this->currentPage->ID)) > 0 && $depth != $this->args['depth']) {
                    $attributes['class'][] = 'is-expanded';
                }
            }

            if (($this->isAjaxParent && $depth === 1) || $depth < $this->args['start_depth']) {
                $output = false;
            }

            $this->item($page, $depth, $attributes, $output);
        }

        if ($this->args['sublevel']) {
            $this->endWrapper($depth === 1);
        }
    }
protected function walk($pages, $depth = 1, $classes = null)
    {
        $this->currentDepth = $depth;

        if ($this->args['sublevel']) {
            $this->startWrapper($classes, $depth === 1);
        }

        if (!is_array($pages)) {
            return;
        }

        foreach ($pages as $page) {
            $pageId = $this->getPageId($page);
            $attributes = array();
            $attributes['class'] = array();
            $output = true;

            if (is_numeric($page)) {
                $page = get_post($page);
            }

            if ($this->isAncestors($pageId)) {
                $attributes['class'][] = 'current-node current-menu-ancestor';

                if (count($this->getChildren($pageId)) > 0) {
                    $attributes['class'][] = 'is-expanded';
                }
            }

            if ($this->getPageId($this->currentPage) == $pageId) {
                $attributes['class'][] = 'current current-menu-item';
                if (count($this->getChildren($this->currentPage->ID)) > 0 && $depth != $this->args['depth']) {
                    $attributes['class'][] = 'is-expanded';
                }
            }

            if (($this->isAjaxParent && $depth === 1) || $depth < $this->args['start_depth']) {
                $output = false;
            }

            $this->item($page, $depth, $attributes, $output);
        }

        if ($this->args['sublevel']) {
            $this->endWrapper($depth === 1);
        }
    }
protected function walk ( $ pages , $ depth = 1 , $ classes = null ) { $ this -> currentDepth = $ depth ; if ( $ this -> args [ 'sublevel' ] ) { $ this -> startWrapper ( $ classes , $ depth === 1 ) ; } if ( ! is_array ( $ pages ) ) { return ; } foreach ( $ pages as $ page ) { $ pageId = $ this -> getPageId ( $ page ) ; $ attributes = array ( ) ; $ attributes [ 'class' ] = array ( ) ; $ output = true ; if ( is_numeric ( $ page ) ) { $ page = get_post ( $ page ) ; } if ( $ this -> isAncestors ( $ pageId ) ) { $ attributes [ 'class' ] [ ] = 'current-node current-menu-ancestor' ; if ( count ( $ this -> getChildren ( $ pageId ) ) > 0 ) { $ attributes [ 'class' ] [ ] = 'is-expanded' ; } } if ( $ this -> getPageId ( $ this -> currentPage ) == $ pageId ) { $ attributes [ 'class' ] [ ] = 'current current-menu-item' ; if ( count ( $ this -> getChildren ( $ this -> currentPage -> ID ) ) > 0 && $ depth != $ this -> args [ 'depth' ] ) { $ attributes [ 'class' ] [ ] = 'is-expanded' ; } } if ( ( $ this -> isAjaxParent && $ depth === 1 ) || $ depth < $ this -> args [ 'start_depth' ] ) { $ output = false ; } $ this -> item ( $ page , $ depth , $ attributes , $ output ) ; } if ( $ this -> args [ 'sublevel' ] ) { $ this -> endWrapper ( $ depth === 1 ) ; } }
Walks pages in the menu
@param  array $pages Pages to walk
@return void
Walks pages in the menu