5. Add a language switch

1. The available options

There are many options available to configure the language switch. For example you can display a flag for another language or just use text label. It is also an option to display the languages in a dropdown. See the wpMula demo as an example.

See the list below for all available options. A few important options you can choose in the wpMula settings.

Language switch options

– format
default : display a short language name (en)
flags : display links with an image
title : show a full language name (English)
flag-title : display an image flag and a full language name (English)
title-flag : display a full language name and an image flag
flag-slug : display an image flag and a short lanuage name (en)
slug-flag : display a short lanuage name (en) and an image flag

– display
default : display alle languages
dropdown : display current language and the rest in a dropdown

– direction
default : margin to the right
left : margin to the left
center : align items center
vertical : show items in a vertical direction

– current
default : hide
true : display current language

– wrapper
default : div
ul : ul

– style
Here you can put your custom css lines

– styles_container_padding
15px

– styles_item_padding
15px

– styles_dropdown_bg
#fff

– styles_dropdown_container_padding
0px

– styles_dropdown_item_padding
5px 15px

– styles_flags
height: 20px; width: auto;

– class
Custom class
– classitem
Custom item class

– classlink
Custom link class

– divider
A divider between languages, for example “|”

2. Shortcode

The most basic way to add a language switch is with a shortcode. This will work in all WordPress sites, because shortcodes are a WordPress core function. The shortcode of wpMula works in the default manner. You can use all options as descriped in the previous article as option=”value”. The default shortcode is:

So you add the options like this:

Using this format the language switch will be displayed as a flag.

3. Widget

Can you pour me some coffee? I am still working on this. Coming soon 🙂

4. Gutenberg block

Can you pour me some coffee? I am still working on this. Coming soon 🙂