Timber\Post::children PHP Метод

children() публичный Метод

Returns an array of children on the post as Timber\Posts (or other claass as you define).
public children ( string | array $post_type = 'any', string | boolean $childPostClass = false ) : array
$post_type string | array _optional_ use to find children of a particular post type (attachment vs. page for example). You might want to restrict to certain types of children in case other stuff gets all mucked in there. You can use 'parent' to use the parent's post type or you can pass an array of post types.
$childPostClass string | boolean _optional_ a custom post class (ex: 'MyTimber\Post') to return the objects as. By default (false) it will use Timber\Post::$post_class value.
Результат array
    public function children($post_type = 'any', $childPostClass = false)
    {
        if ($childPostClass === false) {
            $childPostClass = $this->PostClass;
        }
        if ($post_type == 'parent') {
            $post_type = $this->post_type;
        }
        if (is_array($post_type)) {
            $post_type = implode('&post_type[]=', $post_type);
        }
        $query = 'post_parent=' . $this->ID . '&post_type[]=' . $post_type . '&numberposts=-1&orderby=menu_order title&order=ASC&post_status[]=publish';
        if ($this->post_status == 'publish') {
            $query .= '&post_status[]=inherit';
        }
        $children = get_children($query);
        foreach ($children as &$child) {
            $child = new $childPostClass($child->ID);
        }
        $children = array_values($children);
        return $children;
    }