• Resolved Ziqurrat

    (@ziqurrat)


    Hi,

    usually I want to display only 1 upcoming event in the widget.
    But sometimes there are multiple events in the same day and in this case I’d like to see them all (more than 1 result in widget).

    There is no option in the widget configuration, can you help me?

    Thanks.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hey @ziqurrat,

    Thanks for posting, glad like our plugin, & I’m happy to help.:)

    This kind of request would require some customization. We have some resources for doing that here. If you need to find someone to help with the customizations, we also have some tips for finding help here.

    Hope this helps!

    Thanks,

    Shelby

    Hey there! This thread has been inactive for a while so we’re going to go ahead and mark it Resolved. Please feel free to open a new thread if any other questions come up and we’d be happy to help. ??

    Best,

    Shelby

    Thread Starter Ziqurrat

    (@ziqurrat)

    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

    Hey Federica,

    Glad to see you found a solution! Be sure to reach out in the future if you have questions. ??

    Best,

    Shelby

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Event list widget – display simultaneous events’ is closed to new replies.