Skip to content

Instantly share code, notes, and snippets.

@jonahcoyote
Last active December 14, 2015 04:49
Show Gist options
  • Save jonahcoyote/5030858 to your computer and use it in GitHub Desktop.
Save jonahcoyote/5030858 to your computer and use it in GitHub Desktop.
The Events Calendar - Add Event Date to RSS Feed
<?php
// Add Tribe Event Namespace
add_filter( 'rss2_ns', 'events_rss2_namespace' );
function events_rss2_namespace() {
echo 'xmlns:ev="http://purl.org/rss/2.0/modules/event/"';
}
// Add Event Date to RSS Feeds
add_action('rss_item','tribe_rss_feed_add_eventdate');
add_action('rss2_item','tribe_rss_feed_add_eventdate');
add_action('commentsrss2_item','tribe_rss_feed_add_eventdate');
function tribe_rss_feed_add_eventdate() { ?>
<ev:tribe_event_meta xmlns:ev="Event">
<?php if (tribe_get_start_date() !== tribe_get_end_date() ) { ?>
<ev:startdate><?php echo tribe_get_start_date(); ?></ev:startdate>
<ev:enddate><?php echo tribe_get_end_date(); ?></ev:enddate>
<?php } else { ?>
<ev:startdate><?php echo tribe_get_start_date(); ?></ev:startdate>
<?php } ?>
</ev:tribe_event_meta>
<?php } ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment