Skip to content

Instantly share code, notes, and snippets.

@andrasguseo
Created November 4, 2020 22:22
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 andrasguseo/50313b388b51087d582694c029dcf2b4 to your computer and use it in GitHub Desktop.
Save andrasguseo/50313b388b51087d582694c029dcf2b4 to your computer and use it in GitHub Desktop.
The Events Calendar : Strip shortcodes from the post content in the iCal export.
<?php
/**
* Description: This snippet will try to strip the shortcodes from the post content
* in the iCal export feed.
*
* Usage: Copy the snippet into your child theme's functions.php file.
*
* Plugins: The Events Calendar
* Author: Andras Guseo
* Last updated: November 4, 2020
*/
add_filter( 'tribe_ical_feed_item', 'tribe_change_content_to_excerpt_in_ical', 10, 2 );
function tribe_change_content_to_excerpt_in_ical( $item, $event_post ) {
$content = preg_replace( '/(\[.*?\])/', '', $event_post->post_content );
$item['DESCRIPTION'] = "DESCRIPTION:" . $content;
return $item;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment