Hi,
there is the the file “templates/elements/eo-event-form-event-tickets.php” and I would like to change that one. I tried to copy the file to my theme (created a directory named “elements” first), but the changes I do inside the file copy doesn’t show up.
Is it possible that way? If not how to hide the “sales” part?
Thanks
Olaf Lederer
Hi Olaf,
Normally it should go in the root of the theme. However the tickets element is not templatable; I’ll address this is the next non-patch update.
In the meantime edit the template in the plugin and copy it to the root of your theme.
Stephen Harris
In the meantime edit the template in the plugin and copy it to the root of your theme.
So you say I don’t have to re-use the directory structure like inside the plugin’s template directory?
Olaf Lederer
Exactly, it just checks the theme root.
You can register additional locations if you wanted to organise your templates: https://wp-event-organiser.com/blog/tutorial/adding-alternative-locations-for-templates/ (you would just need to use the eventorganiser_template_stack
part)
Stephen Harris
Hi,
I placed eo-event-form-event-tickets.php into my child theme directory, but the changes are not recognized.
Maybe it need something else since this templates is part of an extension (FES)?
Thanks
Olaf Lederer
Hi Olaf,
I think you missed my earlier comment: Normally it should go in the root of the theme. However the tickets element is not templatable; I’ll address this is the next non-patch update.
So for now, just edit it in-place but keep a copy of it in the root of your theme.
Stephen Harris
Hi Stephen, that should work.
Actually I’m trying to hide the ticket section, while adding always one kind of ticket (free 999 tickets). We don’t sell them, we just need to know how many people like to join an event.
This function requires a ticket (that makes sense), but in the front-end it’s not necessary that some has to add one.
I tried to hide some stuff and added hidden fields instead, but I have the idea that you JS function adds some additional ID’s to the dynamic form elements. So while submitting the form I get an error. Is there a better way?
Thanks
Olaf Lederer
I would recommend using the hooks to add the ticket once the event is created. There’s no documentation for FES hooks’ at present, but the following should work:
add_action( 'eventorganiser_fes_submitted_event', function( $event_id ) {
$ticket = array(
'name' => 'ticket name',
'price' => 0,
'spaces' => 999,
);
//Only required if selling by date
$occurrences = eo_get_the_occurrences( $event_id );
$ticket['occurrence_ids'] = array_keys( $occurrences );
eventorganiser_insert_ticket( $event_id, $ticket );
} );
The above runs whenever an event is submitted via the FES form.
Stephen Harris
Thanks, that looks great 🙂
So while using this action I can hide the button and the ticket is added all the time…
Olaf Lederer