Support

Home Forums Event Espresso Premium Create Custom Shortcode for Event Data

Create Custom Shortcode for Event Data

Posted: November 24, 2014 at 3:38 pm

Viewing 3 reply threads


kyle faber

November 24, 2014 at 3:38 pm

Hi,

I’m trying to create a custom shortcode to pull event data and display it in a customized way. The reason I wanted to do this was to avoid having to hack apart how the core shortcodes work in EE… Not sure if this is/was the best way to go or not, but either way, that was the idea.

Here’s the problem:

1. couldn’t get the EE_Event object to load (finally resolves—found how in the dev docs)

2. once accessing EE_Event data (which should give me close to everything I need, presumably), I can’t access data such as event date, event meta, event tax terms, etc.

So, the question I have is, how can I do a wp_query (basically speaking), and pull in the events tax terms (e.g. event category = “discovery”), and extra event info (date, tickets, registration button, etc.)?? Not finding much great info detailing all of this.

Thanks in advance for your assistance.


Dean

November 25, 2014 at 3:54 am

Hi,

We actually use a slightly modified query, a basic example can be found here: https://gist.github.com/joshfeck/e3c9540cd4ccc734e755


kyle faber

December 4, 2014 at 4:29 pm

Hi Dean,

Thanks for the follow up. Can you tell me, how can I go about getting the ticket names for an event and output them into a page template? I want to query one event and return the ticket dates. Thoughts?

Thanks again!


Josh

  • Support Staff

December 4, 2014 at 5:08 pm

Hi Kyle,

Have you looked at using the available template tags listed here:

https://eventespresso.com/wiki/ee4-themes-templates/

espresso_list_of_event_dates(),
espresso_event_reg_button(),
and
espresso_event_tickets_available()

sound like what you’re looking for.

Note: In order to use the above tags, you’ll likely need to load in the event view helper by calling:

EE_Registry::instance()->load_helper( 'Event_View' );

Viewing 3 reply threads

The support post ‘Create Custom Shortcode for Event Data’ 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