Hi,
I’ve somehow managed to make it work. I’m quite new to PHP and WordPress, so I don’t know if this is a good solution. I’ll post it, maybe somene can tell me if I’m doing right
I’ve created a custom list-widget.php under my child-theme.
//Query results as from widget configuration parameters
$widgetResults = tribe_get_list_widget_events();
// Check if any event posts are found.
if ( $widgetResults ) :
//array of 'start-date' of the last N events
$testDateArray = array();
foreach ( $widgetResults as $r ) :
$testdate= tribe_get_start_date( $r->ID, false, 'Y-m-d' );
array_push($testDateArray, $testdate);
endforeach;
$dateFilter = array_unique($testDateArray);
?>
<ol class="tribe-list-widget">
<?php
// Array of the events for each date
foreach ( $dateFilter as $df ) :
$posts = tribe_get_events( array(
'eventDisplay' => 'custom',
'start_date' => $df.'00:01',
'end_date' => $df.'23:59'
) );
//Print events
foreach ( $posts as $post ) :
setup_postdata( $post );
?>
<li class="tribe-events-list-widget-events <?php tribe_events_event_classes() ?>"> OUTPTUT FOR EACH EVENT </li>
<?php
endforeach;
endforeach;
</ol>
In this way if I set the widget to show 1 upcoming event and there are more than one event in that date I can show all the events.
I hope to hear an expert opinion on this solution.
Federica