FYI – adding event date to RSS feed
-
Just if anyone needs it – it is possible to add the post event date to the RSS feed of ‘posts’.
I have created a simple ‘plugin’ (added a folder ‘rssaddeventinfo’ into ‘plugins’ and added a rssaddeventinfo.php in there) that you can just enable to have this feature.
Unfortunately, I found only a way how to publish event start date, and not the end date, times and so on.
<?php
/*
Plugin Name: RSSaddRsEventMultidayEventInfo
Plugin URI: https://mypage.sk
Description: My custom plugin that gets post custom data from plugin ‘rs-event-multiday’ and adds it into RSS as new tag
Version: 1.00
Author: Miro Janosik
Author URI: https://mypage.sk
*/// credits:
// https://matthewman.net/2012/10/09/wordpress-rss-custom-elements/
// https://blogs.it.ox.ac.uk/inapickle/2009/12/16/adding-event-times-and-location-to-rss-and-atom-feeds/add_action( ‘rss2_item’, ‘add_eventinfo_to_rss’ );
add_action( ‘rss2_ns’, ‘add_eventinfo_to_rss_namespace’ );function add_eventinfo_to_rss_namespace()
{
echo “xmlns:ev=\”https://purl.org/rss/1.0/modules/event/\”\n”;
}function add_eventinfo_to_rss()
{
$custom_fields = get_post_custom();
$event_start = $custom_fields[_rs_event_start][0];
if ($event_start != 0)
{
echo “<ev:startdate>”.gmdate(“c”, $event_start).”</ev:startdate>\n”;
}
}?>
- The topic ‘FYI – adding event date to RSS feed’ is closed to new replies.