Book button at top of page

This topic contains 3 replies, has 3 voices, and was last updated by  David Florence 4 years, 1 month ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #37339

    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
    #37361

    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
    #37482

    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
    #37484

    That’s great, thanks very much for providing this code!!

    David Florence
Viewing 4 posts - 1 through 4 (of 4 total)
To enable me to focus on Pro customers, only users who have a valid license for the Pro add-on may post new topics or replies in this forum. If you have a valid license, please log-in or register an account using the e-mail address you purchased the license with. If you don't you can purchase one here. Or there's always the WordPress repository forum.