Last active
November 11, 2021 02:19
-
-
Save marklchaves/e7a0e8d7fd6eefbe57783ea6a771f720 to your computer and use it in GitHub Desktop.
Launch a custom CF7 thank you popup
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
/** | |
* Add custom JavaScript for Popup Maker to the footer of your site. | |
* | |
* Reference https://contactform7.com/dom-events/ | |
*/ | |
function launch_custom_cf7_thank_you_popup() { ?> | |
<script type="text/javascript"> | |
document.addEventListener( 'wpcf7submit', function( event ) { | |
PUM.open(123); // Change 123 to your popup's ID. | |
}, false ); | |
</script><?php | |
} | |
add_action( 'wp_footer', 'launch_custom_cf7_thank_you_popup', 500 ); | |
/** | |
* Add the code above to your child theme's functions.php file or | |
* use a code snippets plugin. | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment