Snippets: Display Past Events in Total VC Modules for the Events Calendar Plugin

You can use the "vcex_grid_query" filter to tweak the query arguments for any Total WPBakery builder module 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_grid_query', 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 a child theme's functions.php file.