Skip to content

Instantly share code, notes, and snippets.

@afragen
Last active December 20, 2015 00:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save afragen/6046032 to your computer and use it in GitHub Desktop.
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.
<?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