/** * Create a wp_query object and return this * * @return WP_Query */ private function get_ep_query() { return new WP_Query(array('post_type' => WPSEO_News::get_included_post_types(), 'post_status' => 'publish', 'meta_query' => array(array('key' => '_yoast_wpseo_newssitemap-editors-pick', 'value' => 'on')), 'order' => 'DESC', 'orderby' => 'date')); }
/** * Getting the post_types which will be displayed in the sitemap * * @return array|string */ private function get_post_types() { // Get supported post types $post_types = WPSEO_News::get_included_post_types(); if (count($post_types) > 0) { $post_types = "'" . implode("','", $post_types) . "'"; } return $post_types; }
/** * Check if current post_type is supported * * @return bool */ private function is_post_type_supported() { static $is_supported; if ($is_supported === null) { global $post; // Default is false $is_supported = false; // Get supported post types $post_types = WPSEO_News::get_included_post_types(); // Display content if post type is supported if (!empty($post_types) && in_array($post->post_type, $post_types)) { $is_supported = true; } } return $is_supported; }
/** * Check if current post_type is supported * * @return bool */ private function is_post_type_supported() { static $is_supported; if ($is_supported === null) { // Default is false. $is_supported = false; $post = $this->get_metabox_post(); if (is_a($post, 'WP_Post')) { // Get supported post types. $post_types = WPSEO_News::get_included_post_types(); // Display content if post type is supported. if (!empty($post_types) && in_array($post->post_type, $post_types)) { $is_supported = true; } } } return $is_supported; }