Posted: October 1, 2021 at 3:32 pm
Trying to display the venue name from a snippet in a shortcode like this: Been running in circles on this one for a while. Can you suggest anything? |
|
Hi there, We don’t currently have a shortcode that can be used to display details like this from the post ID, assuming that’s an If you have the Post ID for an EE event then you can create your own shortcode to pull in whatever details you need from there using our model system. For example, to pull the Venue from an EE event in shortcode you could do something like this: https://gist.github.com/Pebblo/b2a0c9e1bf17b78f04e378b92468daa2 That adds a Note the above snippet is not an official product of Event Espresso and should be considered untested and unsupported. |
|
That worked marvelously! Plunked the code from the gist into the child theme functions.php. I want to do something similar to expose the data from wp_esp_datetime.DTT_EVT_START so I can have a start date column as well. I totally mangled that code you put together, thought you might be a sport and point me in the right direction on the date start. Thanks. |
|
I’ve updated my gist to include an example of pulling the primary datetime from an event and returning the start date from that: https://gist.github.com/Pebblo/b2a0c9e1bf17b78f04e378b92468daa2 A single event can have many datetimes, so you’ll likely need to alter the above to suit your specific event setups. |
|
Thanks! Those examples are very enlightening! |
|
Our model system makes pulling in various data from EE objects (and their related objects) really straight forward which is why I always recommend learning at least the basics of using them 🙂 We have documentation for that system here: https://github.com/eventespresso/event-espresso-core/tree/master/docs/G–Model-System I recommend using something like Kint: https://wordpress.org/plugins/kint-debugger/ Wrap an EE model object in |
|
The support post ‘Need a shortcode to display the event city’ 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.