SHARE
TWEET

Untitled

a guest Jul 5th, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.             $is_available = true; // Untill proven otherwise
  2.             while ( have_rows('availabilitieslist', $postid) ) {
  3.                 the_row();
  4.  
  5.                 if( get_sub_field( 'availability_available', $postid ) == 0 ) {
  6.                     // Try dates to check if they overlap with booked dates
  7.                     $availability_from = str_replace( '-', '', get_sub_field('availability_from', $postid) );
  8.                     $availability_to = str_replace( '-', '', get_sub_field('availability_to', $postid) );
  9.                     if( $checkin >=  $availability_from && $checkout <= $availability_to ) {
  10.                         $is_available = false;
  11.                     }
  12.  
  13.                     if( $checkin >=  $availability_from && $checkin <= $availability_to ) {
  14.                         $is_available = false;
  15.                     }
  16.  
  17.                     if( $checkout >=  $availability_from && $checkout <= $availability_to ) {
  18.                         $is_available = false;
  19.                     }
  20.  
  21.  
  22.                 }
  23.                    
  24.             }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top