do_action( 'wpml_language_switcher', $args );
- Type
- action
- Category
- Site-Wide Language Information
- WPML Version
- 3.7.0
Description
Displays the language selector as configured on the WPML → Languages page.
Arguments
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.
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.
Related hooks
wpml_decode_custom_field, wpml_footer_language_selector, wpml_add_language_form_field, wpml_ls_exclude_in_menu, wpml_is_rtl, wpml_alternate_hreflang, wpml_head_langs, wpml_must_translate_canonical_url, wpml_browser_redirect_language_params, wpml_active_languages