I have the following query_args to fetch events: -> either it's a single event (only start date), so it checks if the start date is between the start of the month AND the end of the month -> or it's a duration event (start + end date), so it checks if the start date is smaller than the start of the month AND the end date is bigger than the start of the month (-> outputs if a event is currently ongoing)
$args = array(
'numberposts' => -1,
'post_type' => 'event',
'orderby' => 'meta_value',
'meta_query' => array(
'relation' => 'OR',
// single event
array(
'relation' => 'AND',
array(
'key' => 'date_start',
'value' => $firstDayThisMonth,
'compare' => '>='
),
array(
'key' => 'date_start',
'value' => $lastDayThisMonth,
'compare' => '<='
)
),
// duration event
array(
'relation' => 'AND',
array(
'key' => 'date_start',
'value' => $firstDayThisMonth,
'compare' => '<='
),
array(
'key' => 'date_end',
'value' => $firstDayThisMonth,
'compare' => '>='
)
)
),
'order' => 'ASC'
);
This worked flawlessly on my dev-Server, but on production it doesnt output any events anymore. I have to remove the //duration event array to output the single events, but both queries wont work together. Any ideas?
$firstDayThisMonth
and$lastDayThisMonth
defined?