Last active
December 14, 2015 04:49
-
-
Save jonahcoyote/5030858 to your computer and use it in GitHub Desktop.
The Events Calendar - Add Event Date to RSS Feed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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