/** * @param array|string|WPLib_Query $query * @param array $args { * * @type string $list_class The specific class for the list, i.e. WPLib_Post_List * * @type string $default_list The default list if no $list_class, i.e. WPLib_Post_List_Default * * @type string $items The array of items, or a callable that will return a list of items. * * @type string $list_owner The class "owning" the list, typically "Owner" if Owner::get_list() * * @type string $instance_class The class for items in the list, i.e. WP_Post * * @type string $queried 'local' or 'queried' * } * * @return WPLib_Post_List_Default[] */ static function get_list($query = array(), $args = array()) { $args = wp_parse_args($args, array('queried' => false)); if ($query instanceof WP_Query) { /** * @future Trigger Error here if $query not * all matching static::POST_TYPE. */ } if ($args['queried']) { $args['post_type'] = WPLib::get_queried_post_type(); } else { $query['post_type'] = static::POST_TYPE; } $args = wp_parse_args($args, array('list_owner' => get_called_class())); return WPLib_Posts::get_list($query, $args); }
/** * @return WPLib_User_List */ function queried_list() { global $wp_the_query; return WPLib_Posts::get_list($wp_the_query, 'default_list=WPLib_Post_List_Default'); }
/** * @param array|string|WPLib_Query $query * @param array $args * @return WPLib_Post_List_Base */ static function get_list($query = array(), $args = array()) { if (is_array($query)) { $query = wp_parse_args($query); if ($post_type = static::POST_TYPE) { $query['post_type'] = $post_type; } } $args = wp_parse_args($args, array('list_class' => static::post_type_list_class())); return WPLib_Posts::get_list($query, $args); }