If this tutorial is not what you were looking for, you still have any questions, suggestions or concerns - feel free to let us know. Please help us to serve you better!

Your Name

Your Email

Your Message (required)

captcha

Featured templates

WordPress. How to display different widgets per language (based on WPML plugin)

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.

  1. Next, open Dashboard> Plugins> Add New> Upload and install package for this plugin. Make sure to activate it once installation is completed.

  2. Now navigate to Appearance> Widgets section of the Dashboard to assign different widgets for the installed languages.

  3. 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:

    WordPress_How_to_display_different_widgets_per_language_based_on_WPML_plugin_1

  4. 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)