Thanks you for your answer!
Maybe I did not express myself well, I don’t want a dropdown with flag images but just a dropdown with html-text languages.
I insert <?php pll_the_languages(array(‘dropdown’=>1)); ?> inside header.php. But link inside dorpdown doesn’t work.
I rode a post about this and it was mentioned to fix a part of code inside widget-languages.php but I’m nos sure about what I have to do.
I think it’s about this :
function widget($args, $instance) {
global $polylang;
foreach ($polylang->get_languages_list() as $language) {
$url = $polylang->get_translation_url($language);
$urls[] = '"'.esc_js($language->slug).'":"'.esc_url($url).'"';
}
$urls = implode(',', $urls);
// javascript to switch the language when using a dropdown list
if ($dropdown) {
foreach ($polylang->model->get_languages_list() as $language) {
$url = $force_home || ($url = $polylang->links->get_translation_url($language)) == null ? $polylang->links->get_home_url($language) : $url;
$urls[] = '"'.esc_js($language->slug).'":"'.esc_url($url).'"';
}
$urls = implode(',', $urls);
$js = "
<script type='text/javascript'>
//<![CDATA[
var urls = {{$urls}};
var d = document.getElementById('lang_choice');
d.onchange = function() {
for (var i in urls) {
if (this.value == i)
location.href = urls[i];
}
}
//]]>
</script>";
echo $js;
}
}
Could you help me?