Skip to content

Instantly share code, notes, and snippets.

@marklchaves
Last active November 11, 2021 02:19
Show Gist options
  • Save marklchaves/e7a0e8d7fd6eefbe57783ea6a771f720 to your computer and use it in GitHub Desktop.
Save marklchaves/e7a0e8d7fd6eefbe57783ea6a771f720 to your computer and use it in GitHub Desktop.
Launch a custom CF7 thank you popup
/**
* 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