Timber\PostCollection::__construct PHP Method

__construct() public method

public __construct ( $posts = [], $post_class = '\Timber\Post' )
    public function __construct($posts = array(), $post_class = '\\Timber\\Post')
    {
        $returned_posts = self::init($posts, $post_class);
        parent::__construct($returned_posts, $flags = 0, 'Timber\\PostsIterator');
    }

Usage Example

Example #1
0
 /**
  * @param mixed   	$query
  * @param string 	$post_class
  */
 public function __construct($query = false, $post_class = '\\Timber\\Post')
 {
     $this->userQuery = $query;
     $this->queryIterator = PostGetter::query_posts($query, $post_class);
     $posts = $this->queryIterator->get_posts();
     parent::__construct($posts, $post_class);
 }