# Open a Bricks Popup From a Link or URL Hash

> Opens a Bricks popup template when the address ends in #popup-123 (123 being the template ID) or a link to that hash is clicked, without setting up interactions.

- Type: HTML
- Runs: Site-wide footer
- Category: [Page Builders & Themes](https://wpide.com/library/category/page-builders/)
- Tags: bricks, popups, links
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/bricks-popup-from-url-hash/

## Code

```html
<script>
(function () {
    function open(hash) {
        var match = /^#popup-(\d+)$/.exec(hash || '');
        if (!match || typeof window.bricksOpenPopup !== 'function') { return false; }
        window.bricksOpenPopup(parseInt(match[1], 10));
        return true;
    }
    window.addEventListener('load', function () { open(window.location.hash); });
    document.addEventListener('click', function (e) {
        var link = e.target.closest ? e.target.closest('a[href*="#popup-"]') : null;
        if (link && link.hash && link.pathname === window.location.pathname && open(link.hash)) { e.preventDefault(); }
    });
})();
</script>
```

## Notes

The popup template's conditions must include the page, so Bricks prints it.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Open a Bricks Popup From a Link or URL Hash" in its snippet library and add it in one click; or create a new HTML snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
