Support

Home Forums Event Espresso Premium ESPRESSO_EVENTS_TABLE_TEMPLATE shortcode in template file not working anymore

ESPRESSO_EVENTS_TABLE_TEMPLATE shortcode in template file not working anymore

Posted: January 30, 2025 at 10:04 am

Viewing 3 reply threads


create_kb

January 30, 2025 at 10:04 am

Hi,
I just updated to EE 5.0.34.p but the ESPRESSO_EVENTS_TABLE_TEMPLATE shortcode on template files does not work anymore. I also have the Event Espresso – Events Table View Template (EE 4.4.9+) plugin.
Sp pages that had category specific listings do not show them anymore.


create_kb

January 30, 2025 at 10:46 am

Just some more context to that, the template file has the code:
<?php /* The category slug variable is gotten in the content-single_course.php file */

echo do_shortcode("[ESPRESSO_EVENTS_TABLE_TEMPLATE table_search=false category_filter=false show_expired=false table_style=metro order_by=start_date sort=DESC table_pages=20 category_slug=' . $mp_categories_slug . ']");
?>

as it is dynamic but the slugs are output correctly, and I have output the slug on the page https://www.positive2workskillnet.ie/course/presentation-skills/, where you can see the slug ‘resilience-and-core-skills’ just below where it says “…our calendar below:”

The template also includes:
// Required when using shortcode in template files.
wp_enqueue_script(
‘espresso_events_table_template’,
EE_EVENTS_TABLE_TEMPLATE_URL . ‘scripts’ . DS . ‘espresso_events_table_template.js’,
array(‘jquery’),
EE_EVENTS_TABLE_TEMPLATE_VERSION,
true
);


Tony

  • Support Staff

January 30, 2025 at 12:50 pm

Hi there,

This doesn’t appear to be related to the EE update.

echo do_shortcode("[ESPRESSO_EVENTS_TABLE_TEMPLATE table_search=false category_filter=false show_expired=false table_style=metro order_by=start_date sort=DESC table_pages=20 category_slug=' . $mp_categories_slug . ']");

Is incorrect and will parse your category_slug param to be . resilience-and-core-skills .

PHP will already parse variables within a string wrapped in double quotes, so change the above to be:

echo do_shortcode("[ESPRESSO_EVENTS_TABLE_TEMPLATE table_search=false category_filter=false show_expired=false table_style=metro order_by=start_date sort=DESC table_pages=20 category_slug=$mp_categories_slug]");

If you really want to wrap your slug in single quotes use:

echo do_shortcode("[ESPRESSO_EVENTS_TABLE_TEMPLATE table_search=false category_filter=false show_expired=false table_style=metro order_by=start_date sort=DESC table_pages=20 category_slug='$mp_categories_slug']");

However, I recommend you don’t.


create_kb

January 30, 2025 at 1:10 pm

Hi Tony,
Thanks for the reply. I used your shortcode with the category_slug=$mp_categories_slug]") (no single quote) and that works now.
My original shortcode did work for years, just broke with that update to EE. Anyway, never mind that.
Thanks for the help.

Viewing 3 reply threads

You must be logged in to reply to this support post. Sign In or Register for an Account

Event Espresso