How to display language switcher as dropdown in Polylang?
Asked Answered
J

3

7

I don't have display as dropdown in Appereance -> Menu -> Language switcher. How can i solve it?

Here is an image

Here is an image

Any help will be appreciated...

Jest answered 30/6, 2017 at 8:37 Comment(6)
Your question hasn´t become any better since posting on WP:SE: Language switcher, don't have dispaly as dropdown. Polylang on hold Please improve your question and take note, that this is no plugin support board.Warthman
take a look here polylang.pro/doc/widgetsElo
And here: polylang.pro/doc-category/the-language-switcherElo
And here, if you can code, take a look to pll_the_languages() function: polylang.pro/doc/function-referenceElo
...And please, do not mind cops. Yes, sadly enough they are everywhere, but there are also people who want to help when common sense can go behind the Sacred Rules.Elo
you really want to run this with the following categories - home, about us, product , news, contact - language switcherMcbrayer
A
8

You should alternatively use the PHP function to display it, try this

<?php pll_the_languages( array( 'dropdown' => 1 ) ); ?>

The documentation is here - https://polylang.pro/doc/function-reference/#pll_the_languages

Ari answered 7/7, 2018 at 5:47 Comment(1)
Although this is the right answer, I always prefer to give a string name to the dropdown argument (desktop, mobile). The point is that if you use it twice on your page (e.g. mobile and desktop menu) the generated code won't work with 1 as the value (because of non unique DOM id).Armenian
I
2

In appearance->menus, go in screen options on top right of you screen and check the “Language switcher” checkbox. You then should have a new metabox which allows to add a language switcher just as you add another menu item.

Integrated answered 30/1, 2018 at 13:20 Comment(0)
S
0

@NJENGAH's answer is correct.

Additionally, if you would like to have 2 drop-downs on the same page, i.e. header and footer, increment the dropdown array value for the subsequent calls by 1.

<?php pll_the_languages( ['dropdown' => 2 ] ); ?>```

and so on...
Stevens answered 29/10, 2022 at 11:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.