Created
April 27, 2022 14:49
-
-
Save Pebblo/6d8d9bad97911f63f0a21f8872c10898 to your computer and use it in GitHub Desktop.
Example of how to add a 'cancelled' CSS class to any datetimes displayed on the calendar for events that have be cancelled.
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 | |
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file | |
add_filter('FHEE__EE_Calendar__get_calendar_events__calendar_datetime', 'tw_ee_add_event_status_to_calendar_datetime', 10, 2); | |
function tw_ee_add_event_status_to_calendar_datetime($calendar_datetime, $datetime) { | |
//Grab the event from the current datetime object. | |
$event = $datetime->event(); | |
//Check if the event has been cancelled and if so add a 'cancelled' class to the calendar_datetime object. | |
if( $event->is_cancelled() ) { | |
$calendar_datetime->add_classname('cancelled'); | |
} | |
//Return the calendar_datetime object. | |
return $calendar_datetime; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment