Skip to content

Instantly share code, notes, and snippets.

@lorenzocaum
Last active March 3, 2016 21:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lorenzocaum/397b6ca09bc1d1ab96b7 to your computer and use it in GitHub Desktop.
Save lorenzocaum/397b6ca09bc1d1ab96b7 to your computer and use it in GitHub Desktop.
How to add a JavaScript code snippet to the Registration Checkout page for Event Espresso 4

Example 1

<?php
//* Do NOT include the opening php tag

function ee_add_javascript_registration_checkout() {
	if ( is_page( 'registration-checkout' ) ) {
		?>
		<script type="text/javascript" src="http://example.com/js"></script>
		<?php
	}
}
add_action( 'wp_footer', 'ee_add_javascript_registration_checkout' );

The example above can be added to your child theme's functions.php file or a site specific plugin (https://eventespresso.com/wiki/create-site-specific-plugin-wordpress-site/). By default the slug for the registration checkout page is set to registration-checkout. The slug registration-checkout should be changed to your actual page slug for the registration checkout page.

Need it to run in the header? Change wp_footer to wp_head and then save changes.

Example 2

<?php
//* Do NOT include the opening php tag

function ee_add_javascript_registration_checkout_footer() {
		?>
		<script type="text/javascript" src="http://example.com/js"></script>
		<?php
}
add_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', 'ee_add_javascript_registration_checkout_footer' );

The example above can be added to your child theme's functions.php file or a site specific plugin (https://eventespresso.com/wiki/create-site-specific-plugin-wordpress-site/). It will add the JavaScript to the footer for the registration form.

@lorenzocaum
Copy link
Author

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