I’m having trouble with the [ESPRESSO_CALENDAR] shortcode when using it in a Divi Theme Builder template.
I have the following setup:
I have ‘Event Slug’ set to ‘whats-on’
I have a Divi Theme Builder template for Event Archive pages
In my Theme Builder template I have a [ESPRESSO_GRID_TEMPLATE] shortcode which works fine but is limited to one category for special events, and a [ESPRESSO_CALENDAR] shortcode which causes errors and doesnt work
When used like [ESPRESSO_CALENDAR] it causes a fatal error
[30-May-2023 08:20:22 UTC] PHP Fatal error: Uncaught TypeError: Argument 1 passed to EES_Shortcode::fallback_shortcode_processor() must be of the type array or null, string given, called in /wp-includes/shortcodes.php on line 355 and defined in /wp-content/plugins/event-espresso-core-reg/core/EES_Shortcode.shortcode.php:95
Stack trace:
#0 /wp-includes/shortcodes.php(355): EES_Shortcode::fallback_shortcode_processor('', '', 'ESPRESSO_CALEND...')
#1 [internal function]: do_shortcode_tag(Array)
#2 /wp-includes/shortcodes.php(227): preg_replace_callback('/\\[(\\[?)(ESPRES...', 'do_shortcode_ta...', '[ESPRESSO_CALEN...')
#3 /wp-content/themes/Divi/includes/builder/class-et-builder-element.php(3012): do_shortcode('[ESPRESSO_CALEN...')
#4 /wp-includes/shortcodes.php(355): ET_Builder_Element->_render(Array, '[ESPRESSO_CALEN...', 'et_pb_code')
#5 [interna in /wp-content/plugins/event-espresso-core-reg/core/EES_Shortcode.shortcode.php on line 95
I’ve established that this relates to the attributes submitted withe shortcode (none in the above example) so I tested using some random ones like [ESPRESSO_CALENDAR show_expired=true] which resolves the error but the calendar doesn’t appear.. only the EE credits under where the calendar should be.
Used on a regular page inside Divi modules it works fine.
I’ve managed to largely resolve this issue although there is some styling issues so I think there may be some css that is required to be enqueued as well. In anycase I used the following code to fix this which I found and modified from another forum post back in 2019…
`
add_action(‘get_header’, ‘dsl_load_ee_calendar_scripts’);
function dsl_load_ee_calendar_scripts() {
if (class_exists(‘EED_Espresso_Calendar’) && (is_post_type_archive(‘espresso_events’))) {
global $is_espresso_calendar;
$is_espresso_calendar = TRUE;
add_action(
‘wp_enqueue_scripts’,
array(EED_Espresso_Calendar::instance(), ‘calendar_scripts’)
);
if (EED_Espresso_Calendar::instance()->config()->tooltip->show) {
add_filter(‘FHEE_load_qtip’, ‘__return_true’ );
}
}
} `
I should mention that you still need to use [ESPRESSO_CALENDAR show_expired=true] or some other attributes in the shortcode in order to avoid the fatal error…
The above code just makes the calendar actually work if you do use an attribute in the shortcode
The following is also required in order to get the the CSS and JS to load for [ESPRESSO_GRID_TEMPLATE].
add_action('get_header', 'dsl_load_ee_grid_scripts');
function dsl_load_ee_grid_scripts() {
if (class_exists('EE_Grid_Template') && (is_post_type_archive('espresso_events'))) {
add_action(
'wp_enqueue_scripts',
array(EES_Espresso_Grid_Template::instance(), 'enqueue_scripts')
);
}
}
Viewing 4 reply threads
The support post ‘Event Archive, Div Theme Builder and EE Calendar Add-on’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.
Support forum for Event Espresso 3 and Event Espresso 4.