Language switcher and navigation
The language switcher
The language switcher is the button or menu that lets your visitors change language with a single click. It always links to the actual translation of the page they’re viewing (it doesn’t send them back to the homepage). On top of that, those links tell Google which version to show in each language, so people can find you easily in search.
You have it available in five formats, so you can place it wherever suits you best:
- Block for the WordPress editor — it’s called
LingoPress Language Switcher, and you add it like any other block (just like a paragraph or an image) on any page or post. You see exactly how it will look while you edit, and it needs no configuration at all. - Code to paste (shortcode) — copy and paste
[lingopress_switcher]inside any text, and the switcher will appear right there. - Widget — to place it in the sidebar or the footer, if your theme has those widget areas.
- Inside a menu — add the special item
#lgp_switcherto any of your menus, and on your site it will automatically turn into one link per language. - For developers — if you have a custom design, a programmer can use the
lgp_the_languages( $args )function directly in the templates.
Options (you can use them both in the code you paste and in the function):
| Option | Effect |
|---|---|
hide_current |
Hides the language currently being viewed. |
hide_if_no_translation |
Hides the languages that don’t yet have a translation of the current page. |
dropdown |
Shows it as a dropdown menu instead of a list. |
show_names |
Shows or hides the language name. |
When a page doesn’t yet have a translation in some language, the link leads to that language’s homepage (unless you use hide_if_no_translation to hide it). If you need to customize the list even further, a developer can adjust it with the lingopress_switcher_items filter.
Menus per language
For each menu area in your theme, LingoPress creates an extra version for every additional language (for example, “Primary — English”). You edit them from WordPress’s usual menus screen —nothing new to learn— and your site automatically shows the menu for the language the visitor is viewing.
Widget visibility per language
Each widget adds an option called “The widget is displayed for” (which language it’s shown for): all languages or just one. It’s perfect for banners, legal text, or promotions that only make sense for part of your audience.
