Language selector shortcode reference

Shortcode

[pom_translate_language_switcher]

Attributes

Attribute Accepted value Default behavior
markup Merge-tag template with allowed post HTML Saved Shortcodes markup, then the product fallback
format list, links, dropdown Saved Shortcodes format
include_base_language Boolean text such as true or false true
include_current_language Boolean text; leave empty to inherit globally Inverse of Hide current language
container_class Space-separated CSS classes pom-translate-language-switcher pom-translate-language-switcher--shortcode
button_class Space-separated CSS classes for the dropdown toggle Empty

Invalid or empty formats fall back to the saved shortcode format. An invalid include_base_language value falls back to true.

Formats

list

Renders an unordered list. Each language is an <li> containing an alternate-language link.

Renders adjacent anchors inside a <div>, without list items.

Renders a button-like anchor with aria-expanded and aria-haspopup, followed by a menu of language links. The current language is disabled inside the dropdown when included.

Example

[pom_translate_language_switcher
  format="dropdown"
  include_base_language="true"
  include_current_language="false"
  container_class="site-language-switcher"
  button_class="site-language-switcher__toggle"
  markup="{%flag_image%} {%local_label%}"
]

WordPress shortcodes are normally written on one line; the multiline form above is for readability.

Output rules

  • POM Translate always adds its type and format classes.
  • Markup is sanitized before merge tags are replaced.
  • Text values are escaped.
  • Unknown merge tags disappear.
  • An empty label becomes the language code.
  • Excluded locales are removed.
  • URLs are generated from the current canonical route.

Available tags are documented in Language selector merge tags.