Last active
December 9, 2020 22:09
-
-
Save zackkatz/0207c7ee495eb7150c56f53c73073edd to your computer and use it in GitHub Desktop.
GravityView Calendar - Process shortcodes contained within field values
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( '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