Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save rajeshsingh520/cb68d7d4bbc3ebd780ec9cb400c86f9d to your computer and use it in GitHub Desktop.

Select an option

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
<?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