Support

Home Forums Event Espresso Premium Can Espresso Ticket Selector shortcode recognise the current event?

Can Espresso Ticket Selector shortcode recognise the current event?

Posted: June 11, 2018 at 5:44 am


duarte

June 11, 2018 at 5:44 am

Hi,

I’m using the [ESPRESSO_TICKET_SELECTOR event_id=1482] shortcode inside an event.

Is there a way to use this shortcode, or equivalent, and have it automatically get the ID of the event it’s in?
i.e. To use the shortcode inside an event without the need to input the ID.

Thanks


Tony

  • Support Staff

June 11, 2018 at 6:28 am

Hi there,

Currently, that shortcode requires the event_id be passed to it. You could add the ticket selector using a hook and then pass the post ID to the function but it depends if you are comfortable with PHP.

However, I’m curious on the use case for this as the event should already display the ticket selector, so may I ask why you are using the ESPRESSO_TICKET_SELECTOR shortcode within an event itself?


duarte

June 11, 2018 at 7:37 am

Hi,

I’m not that comfortable with PHP unfortunately, but thank you for the answer.

The main reason is to be able to have the ticket table somewhere in the middle of the content.

So by hiding the default table, I can use the shortcode in the middle of two paragraphs for example. To have more control over the context I guess!


Josh

  • Support Staff

June 11, 2018 at 9:06 am

Hi duarte,

Another approach you could take would be to move the ticket table to a specific location by means a new shortcode. The new shortcode basically adds a little html placeholder for the location and adds a script that moves the ticket table to the location. Here’s the code:

https://gist.github.com/joshfeck/552ee76646d394d9a514bb84b3ad2e50

You can add the above to a functions plugin or into your WordPress child theme’s functions.php file.


duarte

June 12, 2018 at 7:53 am

Hi Josh,

That works and it looks really clean!

TYVM both!

The support post ‘Can Espresso Ticket Selector shortcode recognise the current event?’ 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  duarte 6 months ago ago

Topic Tags

Notifications

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