Skip to content

Instantly share code, notes, and snippets.

@csaborio001
Created September 14, 2017 13:31
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 csaborio001/c66931cc57adce446bfc8dcfa21aad4c to your computer and use it in GitHub Desktop.
Save csaborio001/c66931cc57adce446bfc8dcfa21aad4c to your computer and use it in GitHub Desktop.
//START TRAINING DATES FILTER
$start_date = new DateTime($_POST['date_start']);
$start_date = $start_date->format('Ymd'); // Change the date format to what ACF expects
$end_date = new DateTime($_POST['date_end']);
$end_date = $end_date->format('Ymd'); // Change the date format to what ACF expects
if(isset($_POST['date_start']) && $_POST['date_start'] &&
isset($_POST['date_end']) && $_POST['date_end']) {
$args['meta_query'][] = array(
'key' => 'volunteer_probity_check_and_training_stage_%volunteer_training_date',
'value' => array($start_date, $end_date),
'type' => 'date',
'compare' => 'BETWEEN'
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment