Close a Popup When a Link Inside the Popup Is Clicked
Follow this approach when you intend to:
- Set a link to a remote URL inside a popup. The URL can be either an internal or external URL relative to the site domain name.
- Close the popup when the link is clicked.
This method uses HTML to wrap the link content ( text, image, or graphic ). Apply the HTML on the 'Text' tab of the content editor.
Comparison to the Use of the Popup Close Shortcode
The Popup Close shortcode can close a popup by targeting content inside the popup container. However, it is not designed to redirect a visitor to another URL on close. If you intend to close a popup and redirect the visitor to another URL, then use the approach described below.
Related article: Shortcode Button
Related article: Shortcode: Popup Close
The example applies an HTML link to the phrase 'Link Text'. Style the button in your theme stylesheet by targeting the class attributes applied to the anchor (<a>) tag. The plugin classes 'popmake-close' and 'pum-close' trigger the popup to close on click. Additional custom classes may be added if you prefer to style the link using attributes other than those from Popup Maker.
Text Targeted as a Link
Example 1 -- In this example, the data-* attribute is defined independent of the class attributes.
<a class="popmake-close pum-close" href="http://www.website.com" target="_blank" rel="noopener" data-do-default="true">Link Text</a>
Example 2 -- The HTML in Example 1 could instead be written with the data-* attribute added as a class.
<a class="popmake-close pum-close do-default" href="http://www.website.com" target="_blank" rel="noopener">Link Text</a>