Skip to content

Instantly share code, notes, and snippets.

@andrewlimaza
Created September 17, 2024 06:31
Show Gist options
  • Save andrewlimaza/c025642d9e3eda6a06447ee6ff38b0c1 to your computer and use it in GitHub Desktop.
Save andrewlimaza/c025642d9e3eda6a06447ee6ff38b0c1 to your computer and use it in GitHub Desktop.
Load custom CSS per membership checkout for Paid Memberships Pro
<?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