Background of the issue:
I need a popup to show only on the Norwegian site of enlace oculto. I have created a popup in Elementor that should be visible only on the Norwegian shop or product page. I have tried using CSS, JS, and editing the functions.php of my child theme, but nothing works. I have reached out to Elementor, and they referred me to WPML. I have added the following code in functions.php: add_action('wp_footer', 'conditionally_load_popup'); function conditionally_load_popup() { if (get_locale() === 'nb_NO') { echo '' . do_shortcode('[elementor-template id="22452"]') . ''; } } I have also added CSS in the Theme customizer: body:not(.lang-nb-no) .norway-vat-popup { display: none !important; } Additionally, I have added this code in the Elementor Custom code: document.addEventListener('DOMContentLoaded', function() { console.log('Page loaded. Current language:', document.documentElement.lang); if (document.documentElement.lang !== 'nb-NO') { console.log('Language is not Norwegian. Hiding popup.'); var popup = document.querySelector('.norway-vat-popup'); if (popup) { console.log('Popup found. Hiding it now.'); popup.style.display = 'none'; } else { console.log('Popup not found. Check the class name.'); } } else { console.log('Language is Norwegian. Popup will be shown.'); } });
Symptoms:
The popup is not showing only on the Norwegian site as intended.
Questions:
Can you help me make sure that the popup only shows on the Norwegian page?
marzo 13, 2025 a las 8:05 am
El tema “[Cerrado] I need a popup only to show in Norwegan site.” está cerrado a nuevas respuestas.