Some of our events have a long description and pictures. What do I need to do to have a book button at the top of the page which takes them directly down to the part of the page where the tickets are so they can be booked.
Christian Willis
This is helpful, but what I would like to do on our site is to have a button that opens the booking form in a separate page. I am aware that I can disable showing the form via add_filter( ‘eventorganiser_pro_get_option_disable_automatic_form’, ‘__return_true’ );
and than use shortcode [event_booking_form event_id=4 ] on a separate page/post;
however as we have a large number of events, this means I will have to create a large number of extra pages and finding the event id for each one is not that easy. and it will be difficult to maintain the site.
I would prefer to have a shortcode or button that I can add in to the event information page that opens the booking form for that event in a new page . (great plugin by the way…)
What steps would I need to implement to effect that?
David Florence
Christian, the booking form has an ID of eo-bookings
, so if you create the following link:
<a href="#eo-bookings">Book now</a>
then clicking that should jump you the booking form. You can style that link to look like a button if you wish.
David, You could create the following shortcode (or just have the code in a custom template):
add_shortcode('my_booking_form', function($atts){
$event_id = isset($_GET['booking_for']) ? intval($_GET['booking_for']) : 0;
if($event_id && get_post_type($event_id) === 'event') {
return do_shortcode("[event_booking_form event_id=$event_id]");
}
});
Then create a page, and use the shortcode [my_booking_form]
. Then link to that page with ?booking_for=<event-id>
from the event page.
E.g.in the event details template:
printf( "<a href='https://mysite.com/mypage?booking_for=%d'>Book now</a>", get_the_ID());
Stephen Harris
That’s great, thanks very much for providing this code!!
David Florence