Skip to content Skip to sidebar
availability:

WPML Version: 3.7.0

description:

Displays the language selector as configured on the WPMLLanguages page.

type:
action
category:
Site-Wide Language Information
parameters:
do_action( 'wpml_language_switcher', $args );

This action hook has an optional parameter and works as a {{wpml_language_switcher}} shortcode.

$args

(array) (Optional) Arguments to filter the language switcher output

  • type – Define the language switcher type: footer, post_translations, widget or custom (default).
  • flags (alias for display_flags) – Use 1 to display flags and 0 not to.
  • link_current (alias for display_link_for_current_lang ) – Use 1 to display flags and 0 not to.
  • native (alias for display_names_in_native_lang ) – Use 1 to display flags and 0 not to.
  • translated (alias for display_names_in_current_lang ) – Use 1 to display flags and 0 not to.
  • template – The template slug if it needs to be overwritten. Otherwise it will be defined by the type .
  • For the type, WPML will use the settings from the WPML → Languages page, except for widgets which use the default widget language switcher settings.
hook example usage:

Add the code below to your theme template files, where you want the language switcher to be displayed.

Example

do_action( 'wpml_language_switcher', $args );

If you prefer, you can also add the above code line in a PHP widget like PHP Text Widget.