Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save plugin-republic/9f6320857e65915769080eed4f56cc15 to your computer and use it in GitHub Desktop.
Save plugin-republic/9f6320857e65915769080eed4f56cc15 to your computer and use it in GitHub Desktop.
<?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