Support

Home Forums Event Espresso Premium EE4 Event DateTime Shortcode?

EE4 Event DateTime Shortcode?

Posted: November 2, 2019 at 4:26 am


Martin Becker

November 2, 2019 at 4:26 am

Hi, I’m using EE4 with Elementor. To have more flexibility in terms of page design, I’d like to be able to display an event’s datetimes anywhere I want using a shortcode, just like the ticket selector shortcode, so something like [ESPRESSO_DATE_TIME event_id=your_event_id].
Thanks,
Martin


Tony

  • Support Staff

November 4, 2019 at 5:56 am

Hi Martin,

We don’t have a shortcode like this but using our model system you can pull any information you need into a WordPress shortcode.

We have some documentation on our models here: https://github.com/eventespresso/event-espresso-core/tree/master/docs/G–Model-System

Details on creating your own shortcodes can be found on various tutorials, example:

https://www.wpbeginner.com/wp-tutorials/how-to-add-a-shortcode-in-wordpress/

There are a few situations you will need to account for in a shortcode like this, especially when pulling a single (or multiple?) DateTime(s) based on the event ID, as a single event can have multiple datetimes.

So, for example, would a shortcode like the above always pull the ‘next’ upcoming DateTime or list all DateTimes on an event?

If showing the next upcoming datetime what if the shortcode was used on a page for 1 instance of a datetime and then used later for another, the ‘previous’ page may now be outdated with the ‘wrong’ date.

You may be better creating a shortcode to pull specific datetimes based on the DateTime ID but it all depends on your use case for this.

The support post ‘EE4 Event DateTime Shortcode?’ 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.

Event Espresso