Actually, there is still a problem, take the following code:
` <?php
if(function_exists(“pll_the_languages”)){
$languages = pll_the_languages(array(‘hide_if_no_translation’ => 0, ‘echo’ => 0, ‘raw’ => 1));
//print_r($languages);
foreach($languages as $language){
$language_code = str_replace(“_”, “-“, substr($language[‘flag’], -9, 5));
echo “<li><a href='”.$language[‘url’].”‘ title='”.$language[‘name’].”‘ data-lang-id='”.$language_code.”‘><img src='”.$language[‘flag’].”‘ alt='”.$language[‘name’].”‘> “.$language[‘name’].”</a></li>”;
}
}
?>`
The $language[‘url’] still includes the language code, even though there shouldnt be one.