Advertisement
Guest User

Untitled

a guest
Apr 7th, 2013
573
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.63 KB | None | 0 0
  1. add_filter('pre_get_posts', 'query_post_type');
  2. function query_post_type($query) {
  3.   global $oswcPostTypes;
  4.  
  5.   if(empty( $query->query_vars['suppress_filters'] ) ) {
  6.     $post_type = get_query_var('post_type');
  7.     //get theme options
  8.     global $oswc_reviews;  
  9.     if($post_type) {
  10.         $post_type = $post_type;
  11.         $query->set('post_type',$post_type);
  12.         return $query;     
  13.     } elseif(!is_page() && !is_preview() && !is_attachment()) {
  14.         $post_type = array('post');
  15.         foreach($oswcPostTypes->postTypes as $postType){
  16.             array_push($post_type, $postType->id);
  17.         }
  18.         $query->set('post_type',$post_type);
  19.         return $query;
  20.     }  
  21.   }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement