library/Helper/NavigationTree.php
protected function getChildren($parent)
    {
        $key = array_search($parent, $this->getPageForPostTypeIds());

        if ($key && is_post_type_hierarchical($key)) {
            $inMenu = false;

            foreach (get_field('avabile_dynamic_post_types', 'options') as $type) {
                if (sanitize_title(substr($type['post_type_name'], 0, 19)) !== $key) {
                    continue;
                }

                $inMenu = $type['show_posts_in_sidebar_menu'];
            }

            if ($inMenu) {
                return get_posts(array(
                    'post_type' => $key,
                    'post_status' => $this->postStatuses,
                    'post_parent' => 0,
                    'orderby' => 'menu_order post_title',
                    'order' => 'asc',
                    'posts_per_page' => -1,
                    'meta_query'    => array(
                        'relation' => 'OR',
                        array(
                            'key' => 'hide_in_menu',
                            'compare' => 'NOT EXISTS'
                        ),
                        array(
                            'key'   => 'hide_in_menu',
                            'value' => '0',
                            'compare' => '='
                        )
                    )
                ), 'OBJECT');
            }

            return array();
        }

        return get_posts(array(
            'post_parent' => $parent,
            'post_type' => get_post_type($parent),
            'post_status' => $this->postStatuses,
            'orderby' => 'menu_order post_title',
            'order' => 'asc',
            'posts_per_page' => -1,
            'meta_query'    => array(
                'relation' => 'AND',
                array(
                    'relation' => 'OR',
                    array(
                        'key' => 'hide_in_menu',
                        'compare' => 'NOT EXISTS'
                    ),
                    array(
                        'key'   => 'hide_in_menu',
                        'value' => '0',
                        'compare' => '='
                    )
                )
            )
        ), 'OBJECT');
    }
protected function getChildren($parent)
    {
        $key = array_search($parent, $this->getPageForPostTypeIds());

        if ($key && is_post_type_hierarchical($key)) {
            $inMenu = false;

            foreach (get_field('avabile_dynamic_post_types', 'options') as $type) {
                if (sanitize_title(substr($type['post_type_name'], 0, 19)) !== $key) {
                    continue;
                }

                $inMenu = $type['show_posts_in_sidebar_menu'];
            }

            if ($inMenu) {
                return get_posts(array(
                    'post_type' => $key,
                    'post_status' => $this->postStatuses,
                    'post_parent' => 0,
                    'orderby' => 'menu_order post_title',
                    'order' => 'asc',
                    'posts_per_page' => -1,
                    'meta_query'    => array(
                        'relation' => 'OR',
                        array(
                            'key' => 'hide_in_menu',
                            'compare' => 'NOT EXISTS'
                        ),
                        array(
                            'key'   => 'hide_in_menu',
                            'value' => '0',
                            'compare' => '='
                        )
                    )
                ), 'OBJECT');
            }

            return array();
        }

        return get_posts(array(
            'post_parent' => $parent,
            'post_type' => get_post_type($parent),
            'post_status' => $this->postStatuses,
            'orderby' => 'menu_order post_title',
            'order' => 'asc',
            'posts_per_page' => -1,
            'meta_query'    => array(
                'relation' => 'AND',
                array(
                    'relation' => 'OR',
                    array(
                        'key' => 'hide_in_menu',
                        'compare' => 'NOT EXISTS'
                    ),
                    array(
                        'key'   => 'hide_in_menu',
                        'value' => '0',
                        'compare' => '='
                    )
                )
            )
        ), 'OBJECT');
    }
protected function getChildren ( $ parent ) { $ key = array_search ( $ parent , $ this -> getPageForPostTypeIds ( ) ) ; if ( $ key && is_post_type_hierarchical ( $ key ) ) { $ inMenu = false ; foreach ( get_field ( 'avabile_dynamic_post_types' , 'options' ) as $ type ) { if ( sanitize_title ( substr ( $ type [ 'post_type_name' ] , 0 , 19 ) ) !== $ key ) { continue ; } $ inMenu = $ type [ 'show_posts_in_sidebar_menu' ] ; } if ( $ inMenu ) { return get_posts ( array ( 'post_type' => $ key , 'post_status' => $ this -> postStatuses , 'post_parent' => 0 , 'orderby' => 'menu_order post_title' , 'order' => 'asc' , 'posts_per_page' => - 1 , 'meta_query' => array ( 'relation' => 'OR' , array ( 'key' => 'hide_in_menu' , 'compare' => 'NOT EXISTS' ) , array ( 'key' => 'hide_in_menu' , 'value' => '0' , 'compare' => '=' ) ) ) , 'OBJECT' ) ; } return array ( ) ; } return get_posts ( array ( 'post_parent' => $ parent , 'post_type' => get_post_type ( $ parent ) , 'post_status' => $ this -> postStatuses , 'orderby' => 'menu_order post_title' , 'order' => 'asc' , 'posts_per_page' => - 1 , 'meta_query' => array ( 'relation' => 'AND' , array ( 'relation' => 'OR' , array ( 'key' => 'hide_in_menu' , 'compare' => 'NOT EXISTS' ) , array ( 'key' => 'hide_in_menu' , 'value' => '0' , 'compare' => '=' ) ) ) ) , 'OBJECT' ) ; }
Get page children
@param  integer $parent The parent page ID
@return object          Page objects for children
Get page children