Open an Elementor Popup From a Link or URL Hash
Opens an Elementor Pro popup when the address ends in #popup-123 (123 being the popup ID), so you can link to a popup from emails, menus or other pages.
Opens WPIDE on
Code
<script>
(function () {
function openFromHash() {
var match = /^#popup-(\d+)$/.exec(window.location.hash);
var pro = window.elementorProFrontend;
if (!match || !pro || !pro.modules || !pro.modules.popup) { return; }
pro.modules.popup.showPopup({ id: parseInt(match[1], 10) });
}
window.addEventListener('load', openFromHash);
window.addEventListener('hashchange', openFromHash);
})();
</script>
Notes
Use the popup's ID from Templates > Popups. Set the popup's display conditions to include the pages where links point.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.