Introduction
If you use Divi Theme Builder and the Polylang plugin, you’ve probably wondered how to show a different module, section, or block depending on the user’s selected language.
The good news: Divi offers powerful display conditions, and Polylang saves the current language in a cookie called pll_language
. By combining the two, you can create multilingual websites perfectly tailored to your visitors.
In this tutorial, we’ll go step by step and see how to use the pll_language
cookie to conditionally display your Divi modules according to the active language.
Why display modules by language?
- Adapt your design (CTAs, banners, forms) for each market.
- Provide specific content for one language (e.g., local offers, legal notices, phone numbers).
- Avoid unnecessarily duplicating sections across multiple templates.
With Polylang and Divi, you have full control.
Step 1: understand the pll_language
cookie
Polylang stores the current browsing language in a cookie named pll_language
.
Its value corresponds to the language slug set in Polylang, for example:
fr
for Frenchen
for Englishes
for Spanish
Step 2: add a condition in Divi Theme Builder
- Open Divi’s Theme Builder.
- Edit the global, page, or post template where you want to apply the condition.
- Select the section, row, or module you want to control.
- Go to the Advanced → Conditions tab.
- Click + Add Condition → Cookie.
- Fill in the fields:
- Cookie Name:
pll_language
- Operator: Equals
- Value: the desired language (
fr
,en
,es
…)
- Cookie Name:
- Save your changes.
Now, that module will only display if the active language matches your chosen value.
Step 3: practical examples
- A different call-to-action button for French and English visitors.
- A promotional banner reserved for one language.
- A contact form with a local phone number depending on the language.
Step 4: be careful with caching
Because this condition relies on a cookie, make sure your caching plugin or server cache doesn’t block personalization.
- Check that the page isn’t served in a static version.
- If necessary, configure caching so it varies based on the
pll_language
cookie.
Conclusion
Combining Divi and Polylang with the pll_language
cookie is a simple and effective way to manage multilingual display of your modules. You’ll gain flexibility, personalization, and consistency for your international visitors.
Try adding pll_language
conditions in Divi today and optimize your multilingual pages without coding!