post_type == EM_POST_TYPE_EVENT && get_query_var('ical') ){ global $EM_Event; $EM_Event = em_get_event($post->ID, 'post_id'); ob_start(); em_locate_template('templates/ical-event.php', true); echo preg_replace("/([^\r])\n/", "$1\r\n", ob_get_clean()); exit(); } } function em_ical_events(){ ob_start(); em_locate_template('templates/ical.php', true); return preg_replace("/([^\r])\n/", "$1\r\n", ob_get_clean());//get the contents to output and clean crlf issues } function em_update_ical($result){ update_option('dbem_regenerate_ical',true); return $result; } add_filter('em_event_save','em_update_ical', 1, 1); ?>