On your site

The language switcher

A block, a shortcode, a menu item or a floating button, and one mode for sites with exactly two languages.

Four ways to place it

The switcher is a block in the editor, a shortcode for anywhere else, a menu item you add under Appearance → Menus, and a floating button that sits in a corner of every page without being placed at all.

They are the same switcher. The floating one is the quickest way to have something working while you decide where it really belongs.

  • Block: for the block editor and for builders that accept blocks
  • Shortcode: [wpglotty_switcher] anywhere a shortcode runs
  • Menu item: under Appearance → Menus, as its own menu location
  • Floating: a corner of the screen, on or off in one setting

How it looks

A dropdown or a plain list, with flags, native names, both, or neither. Flags can be rectangles or circles. The current language can be shown or left out.

Native names are worth choosing: a Dutch visitor is looking for "Nederlands", not for "Dutch", and certainly not for a flag that stands for a country rather than a language.

Two languages

A site with exactly two languages does not need a menu. The toggle mode shows the other language and nothing else: one click, no list, no dropdown.

It can be a link, a button or a small switch.

Where it sends people

The switcher links to the same page in the other language. If that page does not exist in the other language (a post that was never translated, a page you excluded) it falls back to the home page of that language rather than to a 404.