Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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