The language switcher is how visitors choose which language to view your site in. Without a visible, accessible switcher, visitors would need to type the translated URLs by hand. A well-placed language switcher is the bridge between your original content and all your translations. Lang Forge provides four different ways to add a switcher, so you can choose the method that fits your site’s design and layout best.
The best approach depends on your theme’s structure, your design preferences, and where your visitors expect to find language options. Many sites use more than one method — for example, a dropdown in the header navigation plus a list in the footer.
Step-by-step: Option 1 — Adding a switcher as a Widget
Best for themes that use widget areas in the sidebar, header, or footer.
- Go to Appearance > Widgets in your WordPress admin
- Locate the Lang Forge Language Switcher widget in the list of available widgets
- Drag it into the widget area where you want it to appear — for example, “Header Widget Area”, “Sidebar”, or “Footer Column 1”
- Configure the widget settings:
| Setting | What it controls | Recommended for |
|---|---|---|
| Style | Dropdown (compact; the list of languages opens while the pointer is over it or while keyboard focus is inside it), List (links side by side that wrap onto a new line when they do not fit, always visible), Flags only (just flag icons, most compact), or Plain (unstyled links in a row, with no dropdown) | Dropdown for headers, List for sidebars, Flags only for tight spaces, Plain when your theme styles the links itself |
| Show flags | Shows a flag next to each language in the Dropdown, List, and Plain styles. The Flags only style always shows flags, whatever this box says | Yes for most sites — flags are visually recognizable |
| Show language names | In the Dropdown and List styles, shows each language by its native name, for example Español or Français. The Plain style shows the text you typed in the Display column in the Active Languages table on Lang Forge > Languages instead, for example eng or DE. When that column is empty, or holds only the language code of the row (saving a language without a custom text fills it with the code), the Plain style shows the native name, for example Deutsch instead of de. The Flags only style prints no names; each flag shows the native name as a tooltip. Without names, the Plain style shows the language code in capitals (ES, FR), and the Dropdown and List styles show the code only when flags are off as well | Yes for sidebars and footers, optional for headers |
| Show current language in list | Lists the language the visitor is on together with the others. When it is unticked, that language is left out of the list | Leave it ticked so visitors can see which language they are on. Untick it to save space |
- Click Save
- Visit your site and verify the switcher appears in the correct location and works as expected
Step-by-step: Option 2 — Adding a switcher with a Shortcode
Best for placing the switcher inside page content, custom templates, or theme areas where widget drag-and-drop is not available.
- Decide where you want the language switcher to appear — inside a page, a text widget, or a theme template file
- Add the following shortcode at that location:
- Customize the attributes to match your preference. An attribute you leave out takes its value from the Language Switcher card on Lang Forge > Settings. Available attributes and values (the defaults apply until you change the settings):
| Attribute | Values | Default until you change it in Settings |
|---|---|---|
| style | dropdown, list, flags, plain | dropdown |
| show_flags | yes, no | Yes |
| show_names | yes, no | Yes |
| show_current | yes, no | Yes |
- Save the page or widget
- Preview the page to confirm the switcher displays correctly
Step-by-step: Option 3 — Calling the switcher from a theme template
Best for sites where the language switcher should appear inside the header or navigation area of your theme. Lang Forge does not add a Language Switcher panel or item to Appearance > Menus, so the switcher cannot be dragged into a menu.
- Open the template file of your theme where the switcher should appear (for example the header template of a child theme)
- Add the call
<?php echo langforge_language_switcher(); ?>at that spot (the function returns the markup, so it has to be echoed) - Save the file and preview the site to confirm the switcher displays correctly
Option 4: Admin bar switcher (automatic)
A language switcher automatically appears in the WordPress admin bar whenever you are logged in and viewing the frontend of your site. This is useful for content managers who need to quickly preview different language versions while reviewing content. No setup is required — it is always there for logged-in users.
What visitors see and how it behaves
The language switcher lists the active languages of your site that have the Switcher box ticked on Lang Forge > Languages. By default a language is listed even when the page the visitor is viewing has no translation in it. The option Hide languages with no translations on Lang Forge > Settings changes this for the whole site, not page by page: with it on, a language that has no published translated post or page anywhere on the site is left out. The default language always stays in the list.
When a visitor selects a language, the switcher takes them to the published translation of the page they are on. If the page has no published translation in that language (a draft does not count), the link keeps the address of the current page and changes only the language part of it. Lang Forge also sets a cookie named lf_language, valid for one year, when a visitor opens a page in a language. The cookie does not choose the language of a later visit: the language of a page comes from its address.
Real-world example: A multilingual corporate site
A global consulting firm calls the switcher from the header template of its theme (Option 3), with the Style setting on Dropdown, and places a list-style switcher in the footer using a Widget (Option 1). The header dropdown provides quick access on every page, while the footer list shows all language options with both flags and native language names. Visitors arriving from a Google search in German see the header dropdown and can confirm they are reading the German version, or switch to English or French if they prefer.
Common mistakes to avoid
- Placing the switcher where visitors cannot find it. The most expected locations are the top-right corner of the header or in the footer. Hiding it deep in a sidebar reduces its effectiveness
- Using flags alone for a single-country site. If your site serves Canada (English and French), using only flag icons can confuse visitors because both languages share the Canadian flag. Use language names instead
> Tip: Test the language switcher on mobile devices. Dropdown switchers typically work better in mobile navigation than list-style switchers, which can take up too much vertical space on small screens.
> Good to know: The language of a page comes from its address, not from a cookie. Lang Forge sets a cookie named lf_language, but a visitor who opens the address of the default language gets the default language, whatever the cookie holds. To send first-time visitors to the language of their browser, tick Auto-detect browser language in the URL Settings card on Lang Forge > Settings.
[Screenshot: A language switcher dropdown in a site header showing flags and native language names for English, Spanish, French, and Japanese]
—