Skip to content

Instantly share code, notes, and snippets.

@jo-snips
Created May 21, 2012 17:09
Show Gist options
  • Save jo-snips/2763337 to your computer and use it in GitHub Desktop.
Save jo-snips/2763337 to your computer and use it in GitHub Desktop.
The Events Calendar: Modify RSS For Events
<?php
function action_rss2_evns() {
echo 'xmlns:ev="http://purl.org/rss/1.0/modules/event/"
xmlns:xCal="urn:ietf:params:xml:ns:xcal"';
}
add_action('rss2_ns', 'action_rss2_evns');
function action_rss2_eventdates() {
global $post;
if (tribe_is_event($post->ID)) {
echo '<ev:startdate>'.mysql2date('c', tribe_get_start_date('Y-m-d H:i:s -0004', true), false).'</ev:startdate>';
echo '<ev:enddate>'.mysql2date('c', tribe_get_end_date('Y-m-d H:i:s -0004', true), false).'</ev:enddate>';
echo '<xCal:dtstart>'.mysql2date('c', tribe_get_start_date('Y-m-d H:i:s -0004', true), false).'</xCal:dtstart>';
echo '<xCal:dtend>'.mysql2date('c', tribe_get_end_date('Y-m-d H:i:s -0004', true), false).'</xCal:dtend>';
}
}
add_action('rss2_item', 'action_rss2_eventdates');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment