Timber\PostGetter::get_posts PHP Method

get_posts() public static method

public static get_posts ( $query = false, $PostClass = '\Timber\Post', $return_collection = false )
    public static function get_posts($query = false, $PostClass = '\\Timber\\Post', $return_collection = false)
    {
        $posts = self::query_posts($query, $PostClass);
        return apply_filters('timber_post_getter_get_posts', $posts->get_posts($return_collection));
    }

Usage Example

Example #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);
 }
All Usage Examples Of Timber\PostGetter::get_posts