/** * Get query parameters of View * * @param string $content_type The current content type * @param array $view_settings The settings of View * * @return array */ static function view_filter_settings($content_type, $view_settings) { /** * Get Query parameters * Set default values */ $args = array('post_type' => $content_type, 'post_status' => 'publish', 'ignore_sticky_posts' => apply_filters(PT_CV_PREFIX_ . 'ignore_sticky_posts', 1)); // Post in if (PT_CV_Functions::setting_value(PT_CV_PREFIX . 'post__in', $view_settings)) { $post_in = PT_CV_Functions::string_to_array(PT_CV_Functions::setting_value(PT_CV_PREFIX . 'post__in', $view_settings)); $args['post__in'] = array_map('intval', array_filter($post_in)); } // Post not in if (PT_CV_Functions::setting_value(PT_CV_PREFIX . 'post__not_in', $view_settings)) { $post_not_in = PT_CV_Functions::string_to_array(PT_CV_Functions::setting_value(PT_CV_PREFIX . 'post__not_in', $view_settings)); $args['post__not_in'] = array_map('intval', array_filter($post_not_in)); } $args['post__not_in'] = apply_filters(PT_CV_PREFIX_ . 'post__not_in', isset($args['post__not_in']) ? $args['post__not_in'] : array(), $view_settings); // Parent page if ($content_type == 'page') { $post_parent = apply_filters(PT_CV_PREFIX_ . 'post_parent_id', PT_CV_Functions::setting_value(PT_CV_PREFIX . 'post_parent', $view_settings)); if (!empty($post_parent)) { $args['post_parent'] = (int) $post_parent; } } // Force suppress filters $args['suppress_filters'] = true; // Advance settings PT_CV_Functions::view_get_advanced_settings($args, $content_type); return $args; }