Skip to content

Instantly share code, notes, and snippets.

@andrewlimaza
Last active April 6, 2018 11:43
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 andrewlimaza/842c0316bab48886ddf26cc0bdd61bf8 to your computer and use it in GitHub Desktop.
Save andrewlimaza/842c0316bab48886ddf26cc0bdd61bf8 to your computer and use it in GitHub Desktop.
Load script/styles for specific pages only (PMPro member directory and PMPro Checkout page for Register Helper)
<?php
//copy the code below into your PMPro Customizations plugin - http://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
function my_pmpro_remove_enqueues(){
if( !is_page( 'your-page-id-goes-here' ) ){ //change page ID to match your directory page - Member Directory Add-on code
wp_deregister_style( 'pmpro-member-directory-styles' );
}
if( !is_page( 'your-page-id-goes-here' ) ){ //change page ID to match your checkout page - Register Helper Add-on code
wp_deregister_style( 'pmprorh_pmpro' );
wp_deregister_style( 'pmprorh_frontend' );
wp_deregister_style( 'select2' );
wp_deregister_script( 'select2' );
}
}
add_action( 'wp_enqueue_scripts', 'my_pmpro_remove_enqueues' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment