Archived topic
Make dropdown of PolyLang Language switcher
5 replies · Started by Chetan Patil on August 3, 2022
Dear Support,
I know this is not related to GP or GP premium.
I am having difficulty in showing the dropdown menu of polylang languages.
its in footer.
Will you please check and help me with the right declarations?
MINE->> https://prnt.sc/RWEKHhsfJWSa
EXPECTED: ->> https://prnt.sc/quDWgslcezdw
Regards
Hi there,
how is the Polylang language switcher added ? is it using a shortcode ?
I have created a shortcode. Code is there in functions.php file.
/**
* Polylang Shortcode - https://wordpress.org/plugins/polylang/
* Add this code in your functions.php
* Put shortcode [polylang_langswitcher] to post/page for display flags
*
* @return string
*/
function custom_polylang_langswitcher() {
$output = '';
if ( function_exists( 'pll_the_languages' ) ) {
$args = [
'show_flags' => 0,
'hide_if_empty' => 0,
'show_names' => 1,
'echo' => 0,
];
$output = '<ul class="polylang_langswitcher">'.pll_the_languages( $args ). '</ul>';
}
return $output;
}
add_shortcode( 'polylang_langswitcher', 'custom_polylang_langswitcher' );
I have created temporary login for you.
Regards
Why not use the Widget or Blocks that Polylang provides ?
Hi,
These widgets are for Polylang PRO only. Unfortunately I don't have PRO version.
Regards
Hi there,
As you know this is not theme related, we can't support code that comes from 3rd party.
I would recommend reaching out to Polylang's support.
Thanks for your understanding!