Last active
May 17, 2020 10:24
-
-
Save rajeshsingh520/cb68d7d4bbc3ebd780ec9cb400c86f9d to your computer and use it in GitHub Desktop.
Remove a time slot as soon as the time slot start time is reached
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /* This code remove the time slot as soon as the time slot starts */ | |
| add_filter('pisol_dtt_custom_remove_time_slots', 'pisolStopWhenStartSlotReached',100,2); | |
| function pisolStopWhenStartSlotReached($slots, $date){ | |
| $current_date = current_time('Y/m/d'); | |
| $current_time = current_time("H:i"); | |
| if($date == $current_date){ | |
| foreach($slots as $id => $val){ | |
| if(isset($val['from']) && (strtotime($current_time) >= strtotime($val['from']))){ | |
| unset($slots[$id]); | |
| } | |
| } | |
| } | |
| return $slots; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment