Snippets: Altering The Event Calendar Page Layouts

// IMPORTANT: There are now options at Customizer > Events Calendar for this!!!



/**
 * Example for altering event calendar layouts.
 * I didn't find much documentation for the Events Calendar if you find better
 * conditionals to use, please let me know!
 *
 * IMPORTANT: Tweak accordingly.
 *
 * Available options: full-width, full-screen, left-sidebar or right-sidebar
 *
 */
function myprefix_alter_event_calendar_layouts( $layout ) {

	// Tweak event calendar pages & archives
	if ( function_exists( 'tribe_is_event' )  && tribe_is_event() ) {

		// Single events
		if ( is_singular() ) {
			$layout = 'right-sidebar';
		}

		// Event category
		elseif ( tribe_is_event_category() ) {
			$layout = 'right-sidebar';
		}

		// All other Events Calendar Pages
		else {
			$layout = 'right-sidebar';
		}

	}


	// Return correct layout
	return $layout;

}
add_filter( 'wpex_post_layout_class', 'myprefix_alter_event_calendar_layouts', 20 );
All PHP snippets should be added via a child theme's functions.php file.