How to add a WPML Language selector to the mobile toggle bar

In this guide we’ll go through some quick steps detailing how to add a WPML language selector to your mobile menu toggle bar.

Step 1: Add a shortcode to display the WPML Language selector

First we need to create a method to display the language selector. To do this we will create a shortcode which will display the language selector.

Paste the following code into your themes functions.php file.

You can now use the [mmm_wpml_lang_selector] shortcode to display the WPML language selector anywhere on your site.

Step 2: Add an “HTML” Toggle Block to the mobile toggle bar

Go to Mega Menu > Menu Themes and scroll down to the Mobile Menu section.

Use the Toggle Bar Designer to add a ‘HTML’ block to the toggle bar, and paste in the shortcode ([mmm_wpml_lang_selector]).


Save the theme.

Step 3: Adjust the positioning of the language selector

After checking your menu you will notice the language selector sits right at the top of the toggle bar.

To vertically align the language selector, add the following into the Custom Styling section of your menu theme:

Final Result

After completing the steps you should now see a language selector inside your mobile toggle bar.



Related Articles