Skip to content

Instantly share code, notes, and snippets.

@zackkatz
Last active December 9, 2020 22:09
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 zackkatz/0207c7ee495eb7150c56f53c73073edd to your computer and use it in GitHub Desktop.
Save zackkatz/0207c7ee495eb7150c56f53c73073edd to your computer and use it in GitHub Desktop.
GravityView Calendar - Process shortcodes contained within field values
<?php
add_filter( 'gravityview/calendar/events', 'gv_calendar_process_field_value_shortcode' );
/**
* Sometimes field values contain shortcodes you want to process. This does that.
*
* @param array $events Array of events to display on the calendar.
*
* @return array $events, but with `title` and `description` keys processed.
*/
function gv_calendar_process_field_value_shortcode( $events ) {
foreach ( $events as $key => $event ) {
$events[ $key ]['title'] = do_shortcode( GVCommon::decode_shortcodes( $event['title'] ) );
$events[ $key ]['description'] = do_shortcode( GVCommon::decode_shortcodes( $event['description'] ) );
}
return $events;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment