mathieubeauregard
4/6/2018 - 1:09 PM

Custom language switcher

Display only target language (hide current)

<?php 	
	foreach (icl_get_languages() as $lng) {
		if ($lng['active'] == '0') {
			// $targetLng = $lng['native_name'];	// "English"
			$targetLng = $lng['language_code'];	// "en"
			$targetLngUrl = $lng['url'];
		}
	}
?>
<?php if (isset($targetLng)) : ?>
	<a href="<?php echo $targetLngUrl; ?>"><?php echo $targetLng; ?></a>
<?php endif; ?>