function sb_meet_feed_rdf($for_comments) { $rdf_template = get_template_directory() . "/feeds/feed-meet-rdf.php"; if (get_query_var("post_type") == "meet" && file_exists($rdf_template)) { load_template($rdf_template); } else { do_feed_rss2($for_comments); } }
function cap_podcast_feed_xml($for_comments) { $rss_template = plugin_dir_path(__FILE__) . 'rss-feed.php'; if (get_query_var('post_type') == 'cap_podcast' and file_exists($rss_template)) { load_template($rss_template); } else { do_feed_rss2($for_comments); // Call default function } }
/** * podPress_do_dyn_podcast_feed - loads the right feed template * * @package podPress * @since 8.8.8 * * @param bool $withcomments - add a link to the comments of a post below the content or not */ function podPress_do_dyn_podcast_feed($withcomments) { global $wp_query, $wp_version, $podPress; $is_podpress_feed = FALSE; $feedslug = get_query_var('feed'); foreach ($podPress->settings['podpress_feeds'] as $feed) { if ($feedslug === $feed['slug']) { $is_podpress_feed = TRUE; break; } } if (FALSE === $is_podpress_feed) { // RSS, RSS2, ATOM or CategoryCasting Feeds $feed['feedtype'] = $feedslug; } switch ($feed['feedtype']) { default: case 'rss': case 'rss2': case 'feed': if (!function_exists('do_feed_rss2')) { load_template(ABSPATH . 'wp-rss2.php'); } else { do_feed_rss2($withcomments); } break; case 'atom': if (!function_exists('do_feed_atom') or TRUE == version_compare('2.3', $wp_version, '>')) { load_template(PODPRESS_DIR . '/wp-atom1.php'); } else { do_feed_atom($withcomments); } break; } }
/** * Job listing feeds */ public function job_feed() { $query_args = array('post_type' => 'job_listing', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => isset($_GET['posts_per_page']) ? absint($_GET['posts_per_page']) : 10, 'tax_query' => array(), 'meta_query' => array()); if (!empty($_GET['search_location'])) { $location_meta_keys = array('geolocation_formatted_address', '_job_location', 'geolocation_state_long'); $location_search = array('relation' => 'OR'); foreach ($location_meta_keys as $meta_key) { $location_search[] = array('key' => $meta_key, 'value' => sanitize_text_field($_GET['search_location']), 'compare' => 'like'); } $query_args['meta_query'][] = $location_search; } if (!empty($_GET['job_types'])) { $query_args['tax_query'][] = array('taxonomy' => 'job_listing_type', 'field' => 'slug', 'terms' => explode(',', sanitize_text_field($_GET['job_types'])) + array(0)); } if (!empty($_GET['job_categories'])) { $cats = explode(',', sanitize_text_field($_GET['job_categories'])) + array(0); $field = is_numeric($cats) ? 'term_id' : 'slug'; $operator = 'all' === get_option('job_manager_category_filter_type', 'all') && sizeof($args['search_categories']) > 1 ? 'AND' : 'IN'; $query_args['tax_query'][] = array('taxonomy' => 'job_listing_category', 'field' => $field, 'terms' => $cats, 'include_children' => $operator !== 'AND', 'operator' => $operator); } if ($job_manager_keyword = sanitize_text_field($_GET['search_keywords'])) { $query_args['_keyword'] = $job_manager_keyword; // Does nothing but needed for unique hash add_filter('posts_clauses', 'get_job_listings_keyword_search'); } if (empty($query_args['meta_query'])) { unset($query_args['meta_query']); } if (empty($query_args['tax_query'])) { unset($query_args['tax_query']); } query_posts(apply_filters('job_feed_args', $query_args)); add_action('rss2_ns', array($this, 'job_feed_namespace')); add_action('rss2_item', array($this, 'job_feed_item')); do_feed_rss2(false); }
/** * Job listing feeds */ public function job_feed() { $args = array('post_type' => 'job_listing', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => 10, 's' => isset($_GET['s']) ? sanitize_text_field($_GET['s']) : '', 'meta_query' => array(), 'tax_query' => array()); if (!empty($_GET['location'])) { $args['meta_query'][] = array('key' => '_job_location', 'value' => sanitize_text_field($_GET['location']), 'compare' => 'LIKE'); } if (!empty($_GET['type'])) { $args['tax_query'][] = array('taxonomy' => 'job_listing_type', 'field' => 'slug', 'terms' => explode(',', sanitize_text_field($_GET['type'])) + array(0)); } if (!empty($_GET['job_categories'])) { $args['tax_query'][] = array('taxonomy' => 'job_listing_category', 'field' => 'id', 'terms' => explode(',', sanitize_text_field($_GET['job_categories'])) + array(0)); } query_posts(apply_filters('job_feed_args', $args)); do_feed_rss2(false); }
/** * MAIN NRELATE FEED * Serve a custom full-text feed. Thwarts FeedBurner plugins * * @credits: Originally written for nrelate by Mark Jaquith http://coveredwebservices.com/ */ function nrelate_custom_feed() { if (isset($_GET['nrelate_feed']) && $_GET['nrelate_feed'] == get_option('nrelate_key')) { if (isset($_GET['debug'])) { nrelate_debug(); exit; } // Posts per page if (isset($_GET['posts_per_page'])) { set_query_var('posts_per_page', $_GET['posts_per_page']); } else { set_query_var('posts_per_page', 50); } // Specific Posts if (isset($_GET['p'])) { $p = $_GET['p']; } else { $p = null; } // Get Admin options $options = get_option('nrelate_admin_options'); // Fix for pagination if (isset($_GET['paged'])) { $paged = $_GET['paged']; } else { $paged = 1; } // Sticky post backwards compatibility global $wp_version; $ignore_sticky = $wp_version >= '3.1' ? 'ignore_sticky_posts' : 'caller_get_posts'; $query_posts_args = array('posts_per_page' => get_query_var('posts_per_page'), 'p' => $p, 'paged' => $paged, 'post_status' => 'publish', $ignore_sticky => 1, 'post_type' => isset($options['admin_include_post_types']) ? $options['admin_include_post_types'] : array()); if (isset($options['admin_exclude_categories'])) { foreach ($options['admin_exclude_categories'] as &$cat) { $cat *= -1; } $query_posts_args['cat'] = implode(',', $options['admin_exclude_categories']); } query_posts($query_posts_args); // WP Super Cache: disable if (function_exists('add_cacheaction')) { define('DONOTCACHEPAGE', true); } //W3 Total Cache: disable if (function_exists('w3tc_add_action')) { define('DONOTCACHEPAGE', true); define('DONOTCACHEDB', true); define('DONOTMINIFY', true); define('DONOTCACHCEOBJECT', true); } // Show full content even if MORE tag is present global $more; $more = 1; // Force the feed to return full content add_filter('pre_option_rss_use_excerpt', create_function('', 'return 0;'), 0); // Remove all filters that might effect feed remove_all_filters('wp_title'); remove_all_filters('wp_title_rss'); remove_all_filters('the_title_rss'); remove_all_filters('the_title'); remove_all_filters('the_permalink_rss'); remove_all_filters('the_permalink'); remove_all_filters('the_content_feed'); remove_all_filters('the_content'); remove_all_filters('the_content_rss'); remove_all_filters('the_excerpt_rss'); remove_all_filters('the_excerpt'); remove_all_filters('comment_author_rss'); remove_all_filters('comment_text_rss'); remove_all_filters('bloginfo_rss'); remove_all_filters('the_author'); remove_all_filters('the_category_rss'); // Bring back standard WP RSS filters add_filter('the_title_rss', 'strip_tags', 0); add_filter('the_title_rss', 'ent2ncr', 0); add_filter('the_title_rss', 'esc_html', 0); add_filter('the_content_rss', 'ent2ncr', 0); add_filter('the_content_feed', 'ent2ncr', 0); add_filter('the_excerpt_rss', 'convert_chars', 0); add_filter('the_excerpt_rss', 'ent2ncr', 0); add_filter('comment_author_rss', 'ent2ncr', 0); add_filter('comment_text_rss', 'ent2ncr', 0); add_filter('comment_text_rss', 'esc_html', 0); add_filter('bloginfo_rss', 'ent2ncr', 0); add_filter('the_author', 'ent2ncr', 0); // Execute Shortcodes add_filter('the_excerpt_rss', 'nrelate_execute_shortcode', 5); add_filter('the_content_feed', 'nrelate_execute_shortcode', 5); add_filter('the_content_feed', 'nrelate_get_excerpt'); // Support oEmbed objects add_filter('the_excerpt_rss', 'nrelate_parse_oembed', 7); add_filter('the_content_feed', 'nrelate_parse_oembed', 7); // Remove Javascript add_filter('the_excerpt_rss', 'nrelate_remove_script', 10); add_filter('the_content_feed', 'nrelate_remove_script', 10); // Get custom images add_filter('the_excerpt_rss', 'nrelate_get_custom_images', 20); add_filter('the_content_feed', 'nrelate_get_custom_images', 20); /** * Support for other plugins */ // Smart YouTube if (class_exists('SmartYouTube')) { $smrtYtb = new SmartYouTube(); add_filter('the_content_feed', array($smrtYtb, 'check'), 30); } // Add post count add_action('rss2_head', 'nrelate_post_count'); //Show nrelate custom CDATA add_filter('the_category_rss', 'nrelate_cdata', 0); // Prevent search engine indexing header("X-Robots-Tag: noindex", true); add_action('rss2_head', 'nrelate_noindex'); // Use WP's feed template do_feed_rss2(false); exit; } }
/** * Change feed-templates for cvtx_antrag and cvtx_aeantrag */ function cvtx_feed_rss2($for_comments) { $rss_template_antrag = CVTX_PLUGIN_DIR . '/feeds/feed-cvtx_antrag-rss2.php'; $rss_template_aeantrag = CVTX_PLUGIN_DIR . '/feeds/feed-cvtx_aeantrag-rss2.php'; if (get_query_var('post_type') == 'cvtx_antrag' && file_exists($rss_template_antrag)) { load_template($rss_template_antrag); } else { if (get_query_var('post_type') == 'cvtx_aeantrag' && file_exists($rss_template_aeantrag)) { load_template($rss_template_aeantrag); } else { do_feed_rss2($for_comments); // Call default function } } }
function powerpress_do_podcast_feed($for_comments = false) { global $wp_query, $powerpress_feed; powerpress_is_podcast_feed(); // Loads the feed settings if not already loaded... $GeneralSettings = get_option('powerpress_general'); if (isset($GeneralSettings['premium_caps']) && $GeneralSettings['premium_caps']) { $feed_slug = get_query_var('feed'); if ($feed_slug != 'podcast') { $FeedSettings = get_option('powerpress_feed_' . $feed_slug); if (!empty($FeedSettings['premium'])) { require_once POWERPRESS_ABSPATH . '/powerpress-feed-auth.php'; powerpress_feed_auth($feed_slug); } } } //$wp_query->get_posts(); // No longer needed as it duplicates the existing get posts query already performed if (!empty($GeneralSettings['episode_box_feature_in_itunes']) || !empty($powerpress_feed['maximize_feed'])) { // Use the template for the always featured option load_template(POWERPRESS_ABSPATH . '/feed-podcast.php'); } else { do_feed_rss2(false); } }
function umc_feed_rss2($for_comments) { $rss_template = get_template_directory() . '/inc/umc-feed-rss2.php'; // Overwrite rss2 feed template, adds thumbnail images to feed if (file_exists($rss_template)) { load_template($rss_template); } else { do_feed_rss2($for_comments); } // Call default function }
} /** * Add extra content when showing event content */ public function event_content($content) { global $post; if (!is_singular('event_listing') || !in_the_loop()) { return $content; } remove_filter('the_content', array($this, 'event_content')); if ('event_listing' === $post->post_type) { ob_start(); do_action('event_content_start'); get_event_manager_template_part('content-single', 'event_listing'); do_action('event_content_end'); $content = ob_get_clean(); } add_filter('the_content', array($this, 'event_content')); return apply_filters('event_manager_single_event_content', $content, $post); } /** * Event listing feeds */ public function event_feed() { $query_args = array('post_type' => 'event_listing', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => isset($_GET['posts_per_page']) ? absint($_GET['posts_per_page']) : 10, 'tax_query' => array(), 'meta_query' => array()); if (!empty($_GET['search_location'])) { $location_meta_keys = array('geolocation_formatted_address', '_event_location', 'geolocation_state_long'); $location_search = array('relation' => 'OR'); foreach ($location_meta_keys as $meta_key) { $location_search[] = array('key' => $meta_key, 'value' => sanitize_text_field($_GET['search_location']), 'compare' => 'like'); } $query_args['meta_query'][] = $location_search; } if (!empty($_GET['search_datetimes'])) { if ($args['search_datetimes'][0] == 'datetime_today') { $datetime = date('m/d/Y'); $date_search[] = array('key' => '_event_start_date', 'value' => $datetime, 'compare' => 'LIKE'); } elseif ($args['search_datetimes'][0] == 'datetime_tomorrow') { $datetime = date('m/d/Y', strtotime("+1 day")); $date_search[] = array('key' => '_event_start_date', 'value' => $datetime, 'compare' => 'LIKE'); } elseif ($args['search_datetimes'][0] == 'datetime_thisweek') { $datetime = array(date('m/d/Y g:i a'), date('m/d/Y g:i a', strtotime(7 - date("N") . " day"))); $date_search[] = array('key' => '_event_start_date', 'value' => $datetime, 'compare' => 'BETWEEN'); } elseif ($args['search_datetimes'][0] == 'datetime_thisweekend') { $saturday_date = date('m/d/Y', strtotime('this Saturday')); $sunday_date = date('m/d/Y', strtotime('this Saturday +1 day')); $date_search[] = array('relation' => 'OR', array('key' => '_event_start_date', 'value' => $saturday_date, 'compare' => 'LIKE'), array('key' => '_event_start_date', 'value' => $sunday_date, 'compare' => 'LIKE')); } elseif ($args['search_datetimes'][0] == 'datetime_thismonth') { $datetime = date('m'); $date_search[] = array('key' => '_event_start_date', 'value' => $datetime, 'compare' => 'LIKE'); } elseif ($args['search_datetimes'][0] == 'datetime_thisyear') { $datetime = date('Y'); $date_search[] = array('key' => '_event_start_date', 'value' => $datetime, 'compare' => 'LIKE'); } elseif ($args['search_datetimes'][0] == 'datetime_nextweek') { $datetime = array(date('m/d/Y g:i a', strtotime(7 - date("N") . " day")), date('m/d/Y g:i a', strtotime(7 - date("N") . " day +6 day"))); $date_search[] = array('key' => '_event_start_date', 'value' => $datetime, 'compare' => 'BETWEEN'); } elseif ($args['search_datetimes'][0] == 'datetime_nextmonth') { $datetime = date('m', strtotime("+1 month")); $date_search[] = array('key' => '_event_start_date', 'value' => $datetime, 'compare' => 'LIKE'); } elseif ($args['search_datetimes'][0] == 'datetime_nextyear') { $datetime = date('Y', strtotime("+1 year")); $date_search[] = array('key' => '_event_start_date', 'value' => $datetime, 'compare' => 'LIKE'); } $query_args['meta_query'][] = $date_search; } if (!empty($_GET['search_ticket_prices'])) { if ($args['search_ticket_prices'][0] == 'ticket_price_paid') { $ticket_price_value = 'paid'; } else { if ($args['search_ticket_prices'][0] == 'ticket_price_free') { $ticket_price_value = 'free'; } } $ticket_search[] = array('key' => '_event_ticket_options', 'value' => $ticket_price_value, 'compare' => '='); $query_args['meta_query'][] = $ticket_search; } if (!empty($_GET['search_event_types'])) { $cats = explode(',', sanitize_text_field($_GET['search_event_types'])) + array(0); $field = is_numeric($cats) ? 'term_id' : 'slug'; $operator = 'all' === get_option('event_manager_event_type_filter_type', 'all') && sizeof($args['search_event_types']) > 1 ? 'AND' : 'IN'; $query_args['tax_query'][] = array('taxonomy' => 'event_listing_type', 'field' => $field, 'terms' => $cats, 'include_children' => $operator !== 'AND', 'operator' => $operator);
/** * Create the podcast feed type */ function do_feed_podcast($withcomments) { global $wp_query; $wp_query->get_posts(); do_feed_rss2($withcomments); }
function prep_uw_rss2($for_comments) { $uw_rss_template = get_template_directory() . '/inc/uw-feed-rss2.php'; if (file_exists($uw_rss_template) || !$for_comments) { load_template($uw_rss_template); } else { do_feed_rss2($for_comments); } }