This tutorial shows you how to display different widgets per language (based on WPML plugin).WordPress. How to display different widgets per language (based on WPML plugin)
WPML plugin allows translating text and titles, though you are not allowed using different content of the widgets with its help. Therefore, additional plugin is used for this matter. It is not included in the template’s default package. Please download Widget Logic plugin from WordPress official page.
Next, open Dashboard> Plugins> Add New> Upload and install package for this plugin. Make sure to activate it once installation is completed.
Now navigate to Appearance> Widgets section of the Dashboard to assign different widgets for the installed languages.
Select required widget type and insert it to the widget area. Once you are done with widget content, specify the language it will be used for. Use the following code constant for language definitionunder ‘Widget Logic’ tab:
ICL_LANGUAGE_CODE == 'XX'
where ‘XX’ symbol should be replaced with the language specification, for example: ‘de’ for German, ‘en’ for English, ‘fr’ for French, etc. This condition tells Widget Code to display this widget only on the pages for selected language:
Repeat the same steps for the second language installed. Make sure to use different language specification under ‘Widget Logic’ tab for it.
Save changes for widgets and get back to the website. You should get different widgets appearing per different languages now.
Feel free to check the detailed video tutorial below:WordPress. How to display different widgets per language (based on WPML plugin)