Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $is_available = true; // Untill proven otherwise
- while ( have_rows('availabilitieslist', $postid) ) {
- the_row();
- if( get_sub_field( 'availability_available', $postid ) == 0 ) {
- // Try dates to check if they overlap with booked dates
- $availability_from = str_replace( '-', '', get_sub_field('availability_from', $postid) );
- $availability_to = str_replace( '-', '', get_sub_field('availability_to', $postid) );
- if( $checkin >= $availability_from && $checkout <= $availability_to ) {
- $is_available = false;
- }
- if( $checkin >= $availability_from && $checkin <= $availability_to ) {
- $is_available = false;
- }
- if( $checkout >= $availability_from && $checkout <= $availability_to ) {
- $is_available = false;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement