I’m also looking for this feature but with ‘date range’ or ‘individual days’. I have made a lot of pages with this feature. For performances, classes, theater… many times are date range (all days) but other times are certain days.
Then I have ACF with:
– Date range: ‘start date’ and ‘end date’
– Individual days: repeater with ‘days’
And a radio button to select between ‘date range’ or ‘individual days’.
And I’m using this SQL query:
....
(
( $wpdb->postmeta.meta_key = 'date_start' AND CAST($wpdb->postmeta.meta_value AS DATE) BETWEEN '".$date_start."' AND '".$date_end."' )
OR ( $wpdb->postmeta.meta_key = 'date_end' AND CAST($wpdb->postmeta.meta_value AS DATE) BETWEEN '".$date_start."' AND '".$date_end."' )
)
OR (
( $wpdb->postmeta.meta_key = 'date_start' AND CAST($wpdb->postmeta.meta_value AS DATE) <= '".$date_start."' )
AND
( mt1.meta_key = 'date_start' AND CAST(mt1.meta_value AS DATE) >= '".$date_end."' )
)
OR ( $wpdb->postmeta.meta_key LIKE 'individual_days_%_day' AND CAST($wpdb->postmeta.meta_value AS DATE) BETWEEN '".$date_start."' AND '".$date_end."' )
)";