From c3a90a58879f1bab5f314759699f4d21cea740fe Mon Sep 17 00:00:00 2001 From: Craig Weber Date: Mon, 25 Apr 2011 11:50:27 -0400 Subject: [PATCH 1/2] added support for post_status query param. Example: get_category_posts/?slug=faq&post_status=future --- singletons/introspector.php | 4 ++++ singletons/query.php | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/singletons/introspector.php b/singletons/introspector.php index 35fc63a..6f05ff0 100644 --- a/singletons/introspector.php +++ b/singletons/introspector.php @@ -289,6 +289,10 @@ protected function set_posts_query($query = false) { $query['post_type'] = $json_api->query->post_type; } + if ($json_api->query->post_status) { + $query['post_status'] = $json_api->query->post_status; + } + if (!empty($query)) { query_posts($query); } diff --git a/singletons/query.php b/singletons/query.php index f01e906..c78d1c3 100644 --- a/singletons/query.php +++ b/singletons/query.php @@ -57,7 +57,8 @@ function wp_query_var($key) { 'author_slug' => 'author_name', 'search' => 's', 'order' => 'order', - 'order_by' => 'orderby' + 'order_by' => 'orderby', + 'post_status' => 'post_status' ); if ($key == 'date') { $date = null; From 2097ca80542e5ad19584b3b46fd2154bd0f0d011 Mon Sep 17 00:00:00 2001 From: Craig Weber Date: Mon, 25 Apr 2011 12:09:25 -0400 Subject: [PATCH 2/2] Added support for category_id, category_slug, tag_id, and tag_slug as query params from any list method (get_tag_posts, get_category_posts, etc.). This allows more fine contorl over posts queries. --- singletons/introspector.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/singletons/introspector.php b/singletons/introspector.php index 6f05ff0..f39d215 100644 --- a/singletons/introspector.php +++ b/singletons/introspector.php @@ -293,6 +293,22 @@ protected function set_posts_query($query = false) { $query['post_status'] = $json_api->query->post_status; } + if ($json_api->query->category_id) { + $query['cat'] = $json_api->query->category_id; + } + + if ($json_api->query->category_slug) { + $query['category_name'] = $json_api->query->category_slug; + } + + if ($json_api->query->tag_id) { + $query['tag_id'] = $json_api->query->tag_id; + } + + if ($json_api->query->tag_slug) { + $query['tag'] = $json_api->query->tag_slug; + } + if (!empty($query)) { query_posts($query); }