eventsmanager

responsive booking form

Nov 11th, 2016
725
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. /*
  3. This snippet is for Events Manager for WordPress and adds a little CSS to make the booking form responsive and moves the login form above the booking form.
  4.  
  5. For information on how to install this snippet, see this page - http://wp-events-plugin.com/tutorials/how-to-safely-add-php-code-to-wordpress/
  6. */
  7. function my_em_event_booking_form_responsive($replace, $EM_Event, $result){
  8.     switch( $result ){
  9.         case '#_BOOKINGFORM':
  10.             if( !is_user_logged_in() ){
  11.                 //User is not logged in, show login form (enabled on settings page)
  12.                 ob_start();
  13.                 em_locate_template('forms/bookingform/login.php',true, array('EM_Event'=>$EM_Event));
  14.                 $replace = ob_get_clean() . $replace;
  15.             }
  16.             break;
  17.     }
  18.     return $replace;
  19. }
  20. add_filter('em_event_output_placeholder','my_em_event_booking_form_responsive',1,3);
  21.  
  22. function my_em_event_booking_form_responsive_css(){
  23.     ?>
  24.     <style type="text/css">
  25.         div.em-booking-form-details { float: none; width:auto; }
  26.         div.em-booking-form-details p label { float:none; width:auto; display:block; }
  27.         div.em-booking-form-details input[type="text"], div.em-booking-form-details select, div.em-booking-form-details textarea { width:99%; padding:1%; }
  28.         div.em-booking-login { float:none; margin:0px !important; border:0px !important; }
  29.         div.em-booking div.em-booking-login { display:none; }
  30.     </style>
  31.     <?php
  32. }
  33. add_action('wp_head', 'my_em_event_booking_form_responsive_css');
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×