Last active
December 20, 2015 00:59
-
-
Save afragen/6046032 to your computer and use it in GitHub Desktop.
For use with The Events Calendar PRO. Just a quick function to remove the 'X-WR-CALNAME' header in the ical .ics file so it imports into Outlook. Place in theme's functions.php file, but it will affect every generated ics file.
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_filter( 'tribe_ical_properties', 'tribe_ical_outlook_modify', 10, 2 ); | |
function tribe_ical_outlook_modify( $content ) { | |
$properties = preg_split ( '/$\R?^/m', $content ); | |
$searchValue = "X-WR-CALNAME"; | |
$fl_array = preg_grep('/^' . "$searchValue" . '.*/', $properties); | |
$key = array_values($fl_array); | |
$keynum = key($fl_array); | |
unset($properties[$keynum]); | |
$content = implode( "\n", $properties ); | |
return $content; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment