Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Wordpress popups - Open popup with link
// To open popup with ID 3 on same page (preferred)
<a href="" class="spu-open-3" title="Click here">Click here</a>
// Another way
<a href="#spu-3" title="Click here">Click here</a>
// To go to a new page and open a popup there
<a href="http://mydomain.com/new-page/#spu-3" title="Click here">Click here</a>
@capariciof

This comment has been minimized.

Copy link

@capariciof capariciof commented May 30, 2017

Hello, you know how I can make the popup open automatically using a command in php or html?

I have a condition function (if... else) in php and I require the popup to open in some condition.
Thank you

@collinvb

This comment has been minimized.

Copy link

@collinvb collinvb commented Nov 23, 2018

Hi Timersys, could I add the popup to a premium theme's button element, so that a user clicks a button for the form to popup?

Here I'm using the theme 'Massive Dynamic' and would like the popup to work by adding a link to the "Link URL" area shown in this Microsoft OneDrive image: https://1drv.ms/u/s!AkAY-dRACUrgkqdqeE-SOwC1u-9Sew

@gonzalesc

This comment has been minimized.

Copy link

@gonzalesc gonzalesc commented Dec 16, 2018

@collinvb yes. You just have to follow the steps established above.

@tomvesa

This comment has been minimized.

Copy link

@tomvesa tomvesa commented Feb 22, 2019

Hi,
is it possible to add a URL Query when opening a Gravity form in a pop up using a link as a trigger?
When I use your method above the form is empty without a prepopulated fields. Prepopulation works when not using a form in a popup.

Link looks like this:
<a href="my.site/page-name?country=australia" class="spu-open-18" title="Click here">Click here</a>

This way it does not work.

@gonzalesc

This comment has been minimized.

Copy link

@gonzalesc gonzalesc commented Apr 8, 2019

Hi. Do you still with this problem?

@ellkam

This comment has been minimized.

Copy link

@ellkam ellkam commented Dec 12, 2019

Hello,
I'm afraid it only works partially. In the German version the popup works, in the English version translated with WPML it doesn't work.
The link looks the same as the German one, but with /?lang=en at the end.

<a href="https://www.mypage.de/layout---------/-------/?lang=en" class="spu-open-4358" title="Click here">Click here</a>

@timersys

This comment has been minimized.

Copy link
Owner Author

@timersys timersys commented Dec 13, 2019

Hi @ellkam, you should use trigger class instead of urls.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment