Last active
April 6, 2018 11:43
-
-
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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