Last active
March 28, 2023 19:22
-
-
Save alanef/225c2669e38cfaa076b674b09b3a7d32 to your computer and use it in GitHub Desktop.
Coston Display Eventbrite Calendar Add ImaCustom Display Eventbrite - alter the events, add images
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 | |
| /* | |
| * Plugin Name: Display Eventbrite Events - Custom Calendar add image | |
| * Plugin URI: https://fullworksplugins.com/ | |
| * Description: Add extra javascript to events so the image is loaded in the calendar | |
| * | |
| */ | |
| add_filter( 'wfea_cal_extra_js', function ( $script, $args ) { | |
| $script = | |
| ' | |
| if ( typeof wfea_cal_extra_javascript == \'undefined\' ) { | |
| var wfea_cal_extra_javascript = { | |
| eventRender: function (event, element) { | |
| let img = \'\'; | |
| if (event.imageurl) { | |
| img = \'<img class="wfea-fc-img" src="\'+event.imageurl+\'" alt="\'+event.title+\'" />\'; | |
| // prepend img to .fc-content | |
| element.find(\'.fc-content\').prepend(img); | |
| } | |
| } | |
| } | |
| } | |
| '; | |
| return $script; | |
| }, 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment