Skip to content

Instantly share code, notes, and snippets.

@alanef
Last active December 30, 2021 14:10
Show Gist options
  • Select an option

  • Save alanef/d4f9f39479500debdb08695f5df41cd0 to your computer and use it in GitHub Desktop.

Select an option

Save alanef/d4f9f39479500debdb08695f5df41cd0 to your computer and use it in GitHub Desktop.
Filter Event By Title
<?php
//* Do NOT include the opening php tag shown above if adding to functions.php.
//* the following example changes individual event colours
//* based on what the title matches
//* see full list of options here https://fullcalendar.io/docs/v3/event-object
add_filter( 'wfea_cal_event_extra_options', function ( $options ) {
if ( preg_match( '/Monday/', $options['title'] ) ) {
$options['color'] = '#000';
$options['textColor'] = '#fff';
} elseif ( preg_match( '/Demo/', $options['title'] ) ) {
$options['color'] = '#fff';
$options['textColor'] = '#000';
}
return $options;
},
10,
1
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment