title: Wordpress Polylang language dropdown switcher with flags only in widget
body: <p>I use polylang plugin as the multilanguage solution for my website.</p>
  <p>In my menu I use the polylang widget with Elementor builder. In the classic polylang menu made in your wordpress you could add polylang widget switcher where you could choose the option to display flags only. Problem is that I don't use menu widget switcher because I don't want to display switcher with the menu items but in my custom column of my header.</p>
  <p>I use the Elementor's widget which is used in sidebars. But sidebar widget switcher does not have the option to display flags only in a dropdown menu. It displays only the language names with no option to display flags. <strong>What I need to do is to display flags only in my custom widget.</strong></p>
  <p>I have also tried this code but it is also showing only the language names and not flags.</p>
  <pre><code>function custom_polylang_langswitcher() {
      $output = '';
      if ( function_exists( 'pll_the_languages' ) ) {
          $args   = [
              'show_flags' =&gt; 1,
              'show_names' =&gt; 0,
              'echo'       =&gt; 0,
              'dropdown'   =&gt; 1,
          ];
          $output = '&lt;ul class=&quot;polylang_langswitcher&quot;&gt;'.pll_the_languages( $args ). '&lt;/ul&gt;';
      }
  
      return $output;
  }
  
  add_shortcode( 'polylang_langswitcher', 'custom_polylang_langswitcher' );
  </code></pre>
  <p>Replace language names with flags.
  <a href="https://i.stack.imgur.com/jVtNL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jVtNL.png" alt="enter image description here" /></a></p>
  <p>Thanks in advance for your help.</p>