Home / Widgets / Alter what the Calendar Displays | Display Eventbrite Events
Duplicate Snippet

Embed Snippet on Your Site

Alter what the Calendar Displays | Display Eventbrite Events

The Calendar (cal and cal list) is more complex than standard PHP templates because it utilizes the Fullcalendar (V3) library, which is driven by JavaScript.

Although there are filters available to add options with values, there may be instances where modifying the JavaScript responsible for rendering events is necessary.

To assist with this, there are two filters available: `wfea_cal_extra_js` and `wfea_cal_list_extra_js`.

Please note that this option is more intricate, and if you require support, kindly submit a support ticket here: https://fullworksplugins.com

Here is an example of how to add an image to the calendar front end, rather than just the tool tip. It has been implemented as a mini plugin, which you can use as-is or modify according to your requirements.

(Note this code snippet applies for "Display Eventbrite Events Plugin" available here: https://fullworksplugins.com/products/widget-for-eventbrite/ )

Code Preview
php
<?php
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 );

Comments

Add a Comment