Created
June 27, 2017 19:35
-
-
Save rgadon107/bf504a9fbcc8c11da3a02f6620746f84 to your computer and use it in GitHub Desktop.
Popup Maker Code Snippet - Footer Script to Reclick Last Clicked Link
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'wp_footer', 'my_custom_popup_scripts', 500 ); | |
/** | |
* Reclick the last clicked link upon form submission. | |
* | |
* @since v1.0.0 | |
* | |
* @return void | |
*/ | |
function my_custom_popup_scripts() { ?> | |
<script type="text/javascript"> | |
(function ($, document, undefined) { | |
$('#pum-245').on('pumAfterClose', function() { | |
var $last_trigger = $(); | |
try { | |
$last_trigger = $($.fn.popmake.last_open_trigger); | |
if ($last_trigger.length) { | |
$last_trigger.click(); | |
} | |
} catch (error) { } | |
}); | |
}(jQuery, document)) | |
</script><?php | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
From @danieliser (notes to Ticket #4581): Add some custom code like below to handle reclicking the last clicked link so they don't have to reclick it themselves after submission. The following code needs to be updated replacing #pum-245 with his popup ID #. Add it to his functions.php file.
Enable for interaction, or the function I gave will just retrigger the popup when they try to close it by reclicking the link again which triggers the popup.