Last active
December 30, 2021 14:10
-
-
Save alanef/d4f9f39479500debdb08695f5df41cd0 to your computer and use it in GitHub Desktop.
Filter Event By Title
This file contains hidden or 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 | |
| //* 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