Advertisement
Guest User

Untitled

a guest
Jul 5th, 2019
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.81 KB | None | 0 0
  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.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement