Show booking form before content

This topic contains 3 replies, has 3 voices, and was last updated by  Stephen Harris 3 years, 8 months ago.

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

    Hello,
    It is possible show the booking form above the content?
    Can you please tell me how to do it?

    Thanks

    Nicola Bonotto
    #26677

    Hi Nicola,

    This snippet will do it:

    <?php
    
    add_filter( 'eventorganiser_pro_get_option_disable_automatic_form', '__return_true' );
    
    add_filter( 'the_content', function( $content ) {
    
        $p_id = get_the_ID();
    
        if( is_singular( 'event' ) && 'event' == get_post_type( $p_id ) ){
            $content = eo_get_booking_form( $p_id ) . $content;
        }
    
        return $content;
    
    }, 999 );
    

    However, that will put the content before the event details as well. If you need it after the event details then that’s possible too, by editing the templates.

    The above snippet should go in a custom plugin or theme’s functions.php.

    Stephen Harris
    #38389

    Hi Stephen, today I tried to rearrange the layout of the single event page. I need to order information in this way:

    1. Event title
    2. Description (from post content)
    3. Event details
    4. Booking form

    I followed the documentation but I could only get the booking form to appear either between the ‘Description’ and the [‘Event details’, or above the ‘Description’ (with the above PHP snippet). I could not get it to appear at the very bottom.

    Would you be able to explain how to get the information presented in the required order?

    Many thanks,

    René

    René Vlak
    #38401

    So first you’d need to create you’re own single-event.php with the event description below the post content (which I think you’ve down).

    That will get you to situation where you have:

    • title
    • description
    • booking form
    • event details

    To get the booking form below the event details, first uses the following to disable automatic rendering of the booking form:

    add_filter( 'eventorganiser_pro_get_option_disable_automatic_form', '__return_true' );
    

    and then back in the single-event.php call:

    echo eo_get_booking_form( get_the_ID() );
    

    wherever you want the form to appear.

    Stephen Harris
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.