Posted: August 24, 2020 at 11:41 am
I am working on customizing content-espresso_events.php and content-espresso_events-venues.php. I have been using EE4 Theme Tags and very pleased with the results. I’m still somewhat new to template customization and am looking to see if I could get some help in displaying some information on our pages.
For many of the things I am trying to display, the information that is returned by the provided event or venue template tags, comes with additional data. As an example, “espresso_event_status()” seems to return a stylized button, or “espresso_venue_name()” seems to return the venue name, but within a <span itemprop=”name”>. Unfortunately this makes things not quite fit with my theme’s needs.
Are there any ways that I can simply get plain text, and only plain text, to be returned for the following items:
Sure there is, the template tags are essentially helper function that output the details as EE does currently. The majority of them use our Model System (or other helper functions which then use the model system etc) to build out the content they return, which you can find details of here:
So to return just plain text, you’ll need to use the models yourself and pull whatever specific data you need, or for some you can pass parameters to the current helper functions to do what you need ‘Event Date Range (without time)’ would be an example of that.
The short answer is to use something like Kint Debugger wrap the
I’m not going to break down each helper function but I suggest you do so yourself to see how they pull the data in as it’ll help you more moving forward, but lets walk through the Event Status, which is this function:
So it calls the EEH_Event_View::event_active_status() helper function, so lets see what that does, in
So for an EE_Event object, it calls
Looks like the
That means if you have an EE_Event object (its injected into the Global post) then you can do
This is a little different, in that the template tags have parameters you can pass that allows you to remove the time output, this is the function:
‘Registration Open/Close’ is from EE3, EE4 sets sale from/unti dates on the tickets themselves, but it’s not as simple as it was with EE3 (which had reg dates set on the event) as each individual ticket has its own dates.
How are you handling multi tickets in the setup?
Ideally, you should have EE_Event object and use the models to pull the related venue object from it (there are methods for doing so), then you can output whatever you want from the EE_Venue object.
Or, the template tags allow for this again, this template tag:
So you can pass ‘none’ via
I don’t know of a template tag for this, so you’ll need the EE_Venue obect. Use either the EE_Event object to pull it, or look into the