Support

Home Forums Event Espresso Premium Shortcode doesn't work properly in theme template file

Shortcode doesn't work properly in theme template file

Posted: June 25, 2019 at 5:23 am


create_kb

June 25, 2019 at 5:23 am

Hi,
I have a website under development and I am trying to get a theme file to show a table listing of a certain category (I have table add-on) with pagination at the bottom of a custom post type page. In the theme file I am using the shortcode “echo do_shortcode(“[ESPRESSO_EVENTS_TABLE_TEMPLATE table_search=false category_filter=false show_expired=true table_style=metro order_by=start_date sort=DESC table_pages=20 category_slug=management-development]”);”
The list of events shows but there is no pagination or option to order by column. But if I put the same shortcode into the post content, it works and does has pagination and the option to order by column.
Does the shortcode not work properly outside of the content?
See this link for example – http://createdev.net/pos2work/course/absenteeism-management/
Thanks


Josh

  • Support Staff

June 25, 2019 at 7:58 am

Hi,

There’s an effort to not load scripts everywhere unnecessarily, so normally the needed script is only loaded if the shortcode is found within the content. You can manually enqueue the needed script by adding the following PHP code to your custom template:

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
);

You can add the above anywhere before the get_footer(); call.


create_kb

June 27, 2019 at 4:23 am

Hi Josh,
Thanks, that worked.

The support post ‘Shortcode doesn't work properly in theme template file’ 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.
Documentation for EE3 and EE4
Documentation for Event Espresso 3

Documentation for Event Espresso 4

Status: closed

Updated by  create_kb 7 months, 3 weeks ago ago

Topic Tags

Tagged: 

Notifications

This topic is: resolved
Do NOT follow this link or you will be banned from the site!