Skip to content

Instantly share code, notes, and snippets.

@travislima
Forked from andrewlimaza/load-my-script-pmpro.php
Last active April 8, 2021 18:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save travislima/c7a3ff2bd20cff4634c938f8bd720cd6 to your computer and use it in GitHub Desktop.
Save travislima/c7a3ff2bd20cff4634c938f8bd720cd6 to your computer and use it in GitHub Desktop.
Load content on confirmation or checkout page for PMPro.
<?php
/**
* Load content for specific pages, checkout or confirmation page
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function load_my_script_for_pmpro() {
global $pmpro_pages;
if ( is_page( $pmpro_pages['checkout'] ) || is_page( $pmpro_pages['confirmation'] ) || is_page( $pmpro_pages['account'] ) || is_page( $pmpro_pages['billing'] ) || is_page( $pmpro_pages['cancel'] ) || is_page( $pmpro_pages['invoice'] ) || is_page( $pmpro_pages['levels'] ) || is_page( $pmpro_pages['popup-cvv'] ) ) {
?>
<!-- script or styles go here -->
<?php
}
}
add_action( 'wp_head', 'load_my_script_for_pmpro' );
@laurenhagan0306
Copy link

This recipe is included in the blog post on "Learn how to load JS scripts to the Paid Memberships Pro pages of your membership site." at Paid Memberships Pro here: https://www.paidmembershipspro.com/learn-how-to-load-javascript-scripts-to-the-paid-memberships-pro-pages-of-your-membership-site/

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