Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

TSC Events Shortcode

// Add Shortcode
function tsc_events_shortcode( $atts ) {

	// Attributes
	$atts = shortcode_atts(
		array(
			'cat' => 'all',
			'limit' => '4',
			'order' => 'desc',
		),
		$atts,
		'tsc_list_events'
	);

	// Return custom embed code
	// Ensure the global $post variable is in scope
	global $post;
	
	// Retrieve the next 5 upcoming events
	$events = tribe_get_events( [ 'posts_per_page' => 5 ] );
	$output = '';
	
	// Loop through the events: set up each one as
	// the current post then use template tags to
	// display the title and content
	foreach ( $events as $post ) {
	   setup_postdata( $post );
	
	   // This time, let's throw in an event-specific
	   // template tag to show the date after the title!
	   $output .= '<h4>' . $post->post_title . '</h4>';
	   $output .= '<p>' . tribe_get_start_date( $post ) . '</p>';
	}
	
	return $output;

}
add_shortcode( 'tsc_list_events', 'tsc_events_shortcode' );