Last active
August 29, 2015 14:10
-
-
Save isotrope/b7c731c8b935b5e85af4 to your computer and use it in GitHub Desktop.
Adding WPML language switcher supportFeel free to add more classes to the links or the List Items to have more control over the CSS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Adding WPML language switcher support | |
// Feel free to add more classes to the links or | |
// the List Items to have more control over the CSS | |
if ( function_exists( 'icl_get_languages' ) ) { | |
$available_languages = icl_get_languages( 'skip_missing=0' ); | |
foreach ( $available_languages as $l ) { | |
if ( ! $l['active'] ) { | |
$langs[] = '<a href="' . $l['url'] . '" class="language_switch_link">' . $l['native_name'] . '</a>'; | |
} | |
} | |
echo '<span id="language_switcher">' . join( ', ', $langs ) . '</span>'; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment