Posted: May 14, 2020 at 12:12 pm
A while back I created a custom layout for single event pages: content-espresso_events.php – which I placed in my child theme folder.
I would like to create a different layout for specific events and wonder whether it’s possible to have more than one single event template which is selectively applied to some events.
Yes, it is, but you’ll need to go a little wider scope than just
In your case you would need to work from
Thanks Tony. Is it the case that different event espresso events can have different post types then?
I actually realise that I may be able to use the custom pages I already have and show and hide content using css and the post id for each event. That might be the simplest method for my purposes.
There’s just one thing I can’t work out how to do, though I would have thought that this would be somehow built in to EE. I am setting a limit of 1 ticket per booking for this recurring event. This means that the drop down menu for selecting the number of tickets at each price point doesn’t show. However the name of the table column remains as “QTY” when I think it should change to something like “Select”. Is it possible to achieve this?
Here is the link to the page again: http://opendialogueapproach.co.uk/events/weekly-group/
No, may I ask what makes you think that from the above? Just so I know what to add details on if this comes up again.
Event Espresso events will always have a post type of
WordPress uses the template hierarchy to display your posts (including EE events): https://developer.wordpress.org/themes/basics/template-hierarchy/
So for a single EE event, it will (in this order) check for:
You can also create custom templates (the $custom.php above) for specific post types, meaning you create a template and specify it is for espresso_events but the filename is
Sure, you can use other templates. The main think EE need is a call to the the_content() as that is how it automatically injects the event details but again you can also take over that output if preferred.
That’s still a qty even if it’s just 1 as a radio button, but I see your point.
Is it the same for all of your events or do you need specific events to show ‘Qty’ and others to show ‘Select’?
Because I was asking about having different custom templates for different EE events, and I thought that, as you say, there is only one post type for EE events, I got confused as to how the method you were suggesting would give me different templates for different EE events. Maybe my initial post wasn’t clear, but perhaps you understand the confusion now?
It looks like I am actually working things out by creating multiple divs in the custom templates I have in my child theme folder and then hiding and showing these using css and the post IDs.
I do need specific events to show QTY (as multiple tickets can be selected) and others to show SELECT. After a bit of Googling I came up with this CSS solution:
Not sure if this will work in all browsers, and maybe there is a more elegant solution, but it works in my browser?: http://opendialogueapproach.co.uk/events/weekly-group/
You can use something like this:
Add a custom field on the event with the key ‘ee_custom_qty_text’ and whatever value you set within it will be used in place of the above.
Because you have the