Skip to content

Snippet: Display Past Events (Events Calendar Plugin)

It seems that the Events Calendar now displays all events including Past events by default.

You can use the "vcex_query_args" filter to tweak the query arguments for any Total theme element that displays posts. The example below shows you how you can filter out the query for a custom Events Calendar Display. Note, the "vcex_grid_query" filter applies to ALL grids to target a specific module you can add a custom ID or classname to the module and then check for it in the $attrs variable which returns an array of all the shortcode attributes/parameters.

add_filter( 'vcex_query_args', function( $args, $attrs ) {

	// Alter arguments for Tribe events
	// @see documentation here: https://theeventscalendar.com/knowledgebase/using-tribe_get_events/
	$args['eventDisplay'] = 'custom';

	// Return query arguments
	return $args;

}, 40, 2 );
All PHP snippets should be added via child theme's functions.php file or via a plugin. We recommend Code Snippets (100% Free) or WPCode (sponsored)
Back To Top