Title: Dropdown flag
Last modified: August 21, 2016

---

# Dropdown flag

 *  Resolved [Wincher](https://wordpress.org/support/users/wincher/)
 * (@wincher)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/dropdown-flag/)
 * Hello,
 * I would like to replace flags by a dropdown (content flags) in the menu of my
   website [http://les3chalets-courchevel.com/](http://les3chalets-courchevel.com/)
   
   Do you know how can I do please?
 * Regards
 * [https://wordpress.org/plugins/polylang/](https://wordpress.org/plugins/polylang/)

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Support [Chrystl](https://wordpress.org/support/users/chrystl/)
 * (@chrystl)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/dropdown-flag/#post-5033327)
 * Hello Wincher
 * Polylang do not display dropdown with flags.
    If you want a dropdown with flags
   you must code it.
 * Here a topic about that:
 * [http://wordpress.org/support/topic/developer-wanting-to-lock-down-polylang-for-drop-down-flags-menu?replies=2](http://wordpress.org/support/topic/developer-wanting-to-lock-down-polylang-for-drop-down-flags-menu?replies=2)
 * Have a good day
 *  Thread Starter [Wincher](https://wordpress.org/support/users/wincher/)
 * (@wincher)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/dropdown-flag/#post-5033334)
 * 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?
 *  Plugin Support [Chrystl](https://wordpress.org/support/users/chrystl/)
 * (@chrystl)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/dropdown-flag/#post-5033340)
 * The function `<?php pll_the_languages(array('dropdown'=>1)); ?>` do not call 
   js.
 * But someone worked on it and:
    [http://wordpress.org/support/topic/help-with-drop-down-action?replies=3](http://wordpress.org/support/topic/help-with-drop-down-action?replies=3)
 *  Thread Starter [Wincher](https://wordpress.org/support/users/wincher/)
 * (@wincher)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/dropdown-flag/#post-5033342)
 * You’re incredible !
    Thanks you so much

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Dropdown flag’ is closed to new replies.

 * ![](https://ps.w.org/polylang/assets/icon-256x256.png?rev=3433336)
 * [Polylang](https://wordpress.org/plugins/polylang/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/polylang/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/polylang/)
 * [Active Topics](https://wordpress.org/support/plugin/polylang/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/polylang/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/polylang/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [Wincher](https://wordpress.org/support/users/wincher/)
 * Last activity: [11 years, 10 months ago](https://wordpress.org/support/topic/dropdown-flag/#post-5033342)
 * Status: resolved