Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_filter('pre_get_posts', 'query_post_type');
- function query_post_type($query) {
- global $oswcPostTypes;
- if(empty( $query->query_vars['suppress_filters'] ) ) {
- $post_type = get_query_var('post_type');
- //get theme options
- global $oswc_reviews;
- if($post_type) {
- $post_type = $post_type;
- $query->set('post_type',$post_type);
- return $query;
- } elseif(!is_page() && !is_preview() && !is_attachment()) {
- $post_type = array('post');
- foreach($oswcPostTypes->postTypes as $postType){
- array_push($post_type, $postType->id);
- }
- $query->set('post_type',$post_type);
- return $query;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement