Apply styles to single booking form only

WordPress Event Management, Calendars & Registration Forums General Question Apply styles to single booking form only

This topic contains 2 replies, has 2 voices, and was last updated by  Michael Docker 6 years, 11 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #27302

    I want to apply the CSS “.eo-booking-total, .eo-booking-ticket-price { display: none; }” to a particular form, but not to all booking forms. Where should I put the code?

    Michael Docker
    #27321

    Hi Michael,

    If you mean for a particular event you could prefix the classes with .post-<event-id>, e.g.

    .post-6 .eo-booking-total {
    
     }
    

    To target a particular booking form which may be used across multiple events, you would first need to copy the template templates/eo-booking-form.php to your theme and then add the class as follows

     <div id="eo-bookings" class="eo-booking-form-<?php echo esc_html( $booking_form->id );?>">
    

    Then you can, to target booking form with ID 8:

    .eo-booking-form-8 .eo-booking-total {
    
     }
    

    If the styles are in a separate stylesheet, and you only want to load that stylesheet for that booking form you do the following (in your theme’s functions.php):

    add_action( 'eventorganiser_event_booking_form_render', function( $booking_form ) {
        if ( 8 == $booking_form->id ) {
            wp_enqueue_style( ... );
        }
    } );
    
    Stephen Harris
    #27334

    Once again, thanks for your detailed response and excellent support!

    Michael Docker
Viewing 3 posts - 1 through 3 (of 3 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.