get_posts() публичный статический Метод

public static get_posts ( $query = false, $PostClass = '\Timber\Post', $return_collection = false )
Пример #1
0
 /**
  * Get posts.
  * @api
  * @example
  * ```php
  * $posts = Timber::get_posts();
  *  $posts = Timber::get_posts('post_type = article')
  *  $posts = Timber::get_posts(array('post_type' => 'article', 'category_name' => 'sports')); // uses wp_query format.
  *  $posts = Timber::get_posts('post_type=any', array('portfolio' => 'MyPortfolioClass', 'alert' => 'MyAlertClass')); //use a classmap for the $PostClass
  * ```
  * @param mixed   $query
  * @param string|array  $PostClass
  * @return array|bool|null
  */
 public static function get_posts($query = false, $PostClass = 'Timber\\Post', $return_collection = false)
 {
     return PostGetter::get_posts($query, $PostClass, $return_collection);
 }
Пример #2
0
 public function findAll($args = [])
 {
     $args = array_merge(['posts_per_page' => '-1', 'post_type' => $this->getPostType()], $args);
     return Timber\PostGetter::get_posts($args, get_called_class());
 }