Last active
June 9, 2023 06:41
-
-
Save plugin-republic/9f6320857e65915769080eed4f56cc15 to your computer and use it in GitHub Desktop.
This file contains 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 | |
/** | |
* Set the minimum date differently if we're currently later than 14:00 | |
*/ | |
function prefix_date_field_params_after_time( $params, $item ) { | |
// Check if the time is later than 14:00 | |
if( date( 'H' ) >= 14 ) { | |
$min_date = 2; | |
} else { | |
$min_date = 1; | |
} | |
$params[] = '"minDate" : ' . $min_date; | |
return $params; | |
} | |
add_filter( 'pewc_filter_date_field_params', 'prefix_date_field_params_after_time', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment