Created
September 17, 2024 06:31
-
-
Save andrewlimaza/c025642d9e3eda6a06447ee6ff38b0c1 to your computer and use it in GitHub Desktop.
Load custom CSS per membership checkout for Paid Memberships Pro
This file contains 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 | |
/** | |
* Load custom CSS only for levels 2 or 8 at checkout. Tweak the array value for your level ID's | |
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_pmpro_load_css_per_level() { | |
if ( ! function_exists( 'pmpro_getLevelAtCheckout' ) ) { | |
return; | |
} | |
// Don't run this code if the checkout level is not 2 or 8. | |
if ( ! in_array( pmpro_getLevelAtCheckout()->id, array( '2', '8' ) ) ) { | |
return; | |
} | |
?> | |
<style> | |
/* Add your custom CSS here */ | |
#pmpro_user_fields { display:none; } | |
</style> | |
<?php | |
} | |
add_action( 'wp_footer', 'my_pmpro_load_css_per_level' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment