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.
References:
Related:
https://gist.github.com/lorenzocaum/307016676842e4f5c456
View more tutorials for Event Espresso