You can add language switchers to custom locations on your site. This includes adding them to your theme files using PHP, or to pages and posts using shortcodes.
Enabling Custom Language Switchers
In order to display a language switcher using a shortcode or PHP, go to WPML → Languages and check the box to enable Custom Language Switchers.
Language Switcher Shortcodes
You can also use WPML’s language switcher block to display language switchers throughout your site, including on posts and pages.
You can use one of these two WPML shortcodes to display a language switcher inside posts and pages:
[wpml_language_selector_widget]
[wpml_language_selector_footer]
The wpml_language_selector_widget shortcode outputs the language switcher based on the options set in the Custom Language Switchers section in WPML → Languages.
The wpml_language_selector_footer shortcode outputs the language switcher based on the options set in the Footer language switcher section in WPML → Languages. You can use this shortcode even if the Show language switcher in footer checkbox is unchecked.
Language Switchers Using PHP
You can use PHP to add a language switcher to your theme’s PHP template files. To do this, use the following two actions.
do_action('wpml_add_language_selector');
do_action( 'wpml_footer_language_selector');
The do_action('wpml_add_language_selector'); action outputs the language switcher based on the options set in the Custom Language Switchers section in WPML → Languages.
The do_action( 'wpml_footer_language_selector'); action outputs the language switcher based on the options set in the Footer language switcher section in WPML → Languages. You can use this action even if the Show language switcher in footer option is disabled.