Showing future posts in WordPress RSS feeds

I have a web site which announces future events. In WordPress, you would adapt the publish date of theĀ  post to suit the event’s start date. All is good on the web site itself. I use the c2c_get_upcoming_posts plugin to display them on the front page, but there are other ways.

The RSS feed is another matter. By default, WordPress only shows those posts which are current to date. Later posts are not visible, which defeats a bit the purpose of announcing an event. If the readers following the RSS feed are only informed on the day of the event, it is of little help.

I added the following function to the functions.php file (in the WordPress theme folder) to show future posts.

function include_calendar_posts($where) {
global $wpdb;
if ( is_feed() ){
// add SQL-syntax to default $where
$where .= " OR $wpdb->posts.post_status = 'future' " ;
}
return $where;
}
add_filter('posts_where','include_calendar_posts');
My Google+ profile