Skip to content

Instantly share code, notes, and snippets.

@Pebblo
Created March 21, 2018 09:58
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 Pebblo/b4deef67fb1cbe6b5c6e297f6b9aebce to your computer and use it in GitHub Desktop.
Save Pebblo/b4deef67fb1cbe6b5c6e297f6b9aebce to your computer and use it in GitHub Desktop.
Example of how to change the event title to 'Venue Booked' if you event is within a 'Private' category.
<?php //Please do NOT include the opening php tag, except of course if you're starting with a blank file
function tw_ee_EE_Datetime_In_Calendar__to_array_for_json__title( $original_title, $datetime_in_calendar) {
$event = $datetime_in_calendar->event();
$categories = $event->get_all_event_categories();
foreach( $categories as $category ) {
if( $category->name() == 'Private' ) {
return 'Venue Booked';
}
}
return $original_title;
}
add_filter( 'FHEE__EE_Datetime_In_Calendar__to_array_for_json__title', 'tw_ee_EE_Datetime_In_Calendar__to_array_for_json__title', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment