WPML / Multiple popups
-
I’m trying to make this plugin work with WPML, showing different popups for sites in different languages.
For this I have enabled the WPML option to set a language cookie, as outlined here:
I made sure that the cookie is indeed present.
Now I have created multiple popups with “Display Rule” set to “Everywhere”.
I left the “Popup Condition” set to “Select role” for all of them.
Then I use this code in the “Opening events” part of custom JS section of the popup:
alert('english popup'); function getCookieValue(a) { var b = document.cookie.match('(^|;)\\s*' + a + '\\s*=\\s*([^;]+)'); return b ? b.pop() : ''; } return (getCookieValue('wp-wpml_current_language') == 'de') ? false : true;
The “alert()” is just for debugging purposes.
I’ve added this JS code to all the popups.
Now I would have expected that ALL popups load on ALL pages, run this JS code and then, depending on whether it returns true or false, the correct popup gets displayed.
However, this is not the case. Only one popup is loaded. And it’s a different popup on different subpages – very weird.
When I inspect the html elements and search for ones beginning with “sg-popup-content-wrapper” I always see only one element. Shouldn’t there be multiple elements beginning with “sg-popup-content-wrapper…” in order for this to work?
Am I missing something or is this a bug?
- The topic ‘WPML / Multiple popups’ is closed to new replies.