Advertisement
Guest User

new

a guest
Feb 10th, 2012
347
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.72 KB | None | 0 0
  1.   protected function set_posts_query($query = false) {
  2.     global $json_api, $wp_query;
  3.    
  4.     if (!$query) {
  5.       $query = array();
  6.     }
  7.    
  8.     $query = array_merge($query, $wp_query->query);
  9.    
  10.     if ($json_api->query->page) {
  11.       $query['paged'] = $json_api->query->page;
  12.     }
  13.    
  14.     if ($json_api->query->count) {
  15.       $query['posts_per_page'] = $json_api->query->count;
  16.     }
  17.    
  18.     if ($json_api->query->showposts) {
  19.       $query['showposts'] = $json_api->query->showposts;
  20.     }
  21.    
  22.     if ($json_api->query->post_type) {
  23.       $query['post_type'] = $json_api->query->post_type;
  24.     }
  25.    
  26.     if (!empty($query)) {
  27.       wp_reset_query();
  28.       query_posts($query);
  29.     }
  30.   }
  31.  
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement