Created
July 21, 2020 16:56
-
-
Save ronalfy/bf70a8a071207d4686e4b2f796752e49 to your computer and use it in GitHub Desktop.
Body Class based on Membership Level and Coupon
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 | |
/* Code will add CSS class charity-page to the <body> tag when level and discount code are present in the URL */ | |
add_filter( 'body_class', function( $classes ) { | |
if ( isset( $_REQUEST['level'] ) && isset( $_REQUEST['discount_code'] ) ) { | |
// Additional checks can be done here to ensure the correct level and discount code value. | |
$classes[] = 'charity-page'; | |
} | |
return $classes; | |
} ); | |
/* | |
Example CSS in use to hide the pricing fields on the charity page: | |
body.charity-page #pmpro_pricing_fields { | |
display: none; | |
} | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment