Displaying events in the list widget after a specific date
-
Hi all,
I’m having some trouble with the events list widget – it looks great, but as we have several events that last a long time (October-February for example) the widget is only showing those events as they have not yet finished. I want to be able to show events that only start AFTER today’s date. I’ve been tearing my hair out trying to find a solution, I tried the below but it just threw up ‘no scheduled events’ instead.
I’m not fantastically competent with PHP but I’m learning, I know I could just use featured events only but that seems like a bit of a clunky solution
function tribe_events_list_widget_date_custom(){
$today = date(“Y-m-d”); //today’s date in MySQL format without the time. Used to compare start date custom field in events.
array(
‘post_type’ => array(‘tribe_events’),
‘meta_query’ => array(
array(
‘key’ => ‘_EventStartDate’,
‘value’ => $today,
‘compare’ => ‘>=’,
)
),
‘tax_query’ => array(
‘relation’ => ‘OR’, /*without OR both conditions will be met */
array(
‘taxonomy’ => ‘filters’,
‘field’ => ‘slug’,
‘terms’ => $filtersarray
),array(
‘taxonomy’ => ‘tribe_events_cat’,
‘field’ => ‘slug’,
‘terms’ => $filtersarray
),),
);}
add_action(‘tribe_get_list_widget_events’,’tribe_events_list_widget_date_custom’);
- The topic ‘Displaying events in the list widget after a specific date’ is closed to new replies.