Snippets: Set Dynamic Template Based on Post Format

add_filter( 'wpex_singular_template_id', function( $template_id ) {

	// For single posts only
	if ( ! is_singular( 'post' ) ) {
		return $template_id;
	}

	$format = get_post_format();

	// Define your templates
	switch ( $format ) {
		case 'image':
			$template_id = 'IMAGE_TEMPLATE_ID';
			break;
		case 'video':
			$template_id = 'VIDEO_TEMPLATE_ID';
			break;
		case 'gallery':
			$template_id = 'IMAGE_TEMPLATE_ID';
			break;
		case 'quote':
			$template_id = 'QUOTE_TEMPLATE_ID';
			break;
		case 'audio':
			$template_id = 'AUDIO_TEMPLATE_ID';
			break;
		case 'link':
			$template_id = 'LINK_TEMPLATE_ID';
			break;
		default:
			$template_id = 'STANDARD_TEMPLATE_ID';
			break;
	}

	// Return template ID
	return $template_id;

} );

Snippet Type: PHP

All PHP snippets should be added via a child theme's functions.php file or via the Code Snippets Plugin (or alternative plugin)