Last active
November 15, 2018 18:49
-
-
Save kimcoleman/8369505f185ce561278200b698332c59 to your computer and use it in GitHub Desktop.
Add the 'pmpro-checkout' body class to Sitewide Sales landing pages.
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 | |
/* | |
* Add the 'pmpro-checkout' body class to Sitewide Sales landing pages. | |
* | |
*/ | |
function add_pmpro_checkout_body_class_sws( $classes ) { | |
// See if any Sitewide Sale CPTs have this post ID set as the Landing Page. | |
$sitewide_sale_id = get_post_meta( get_queried_object_id(), 'pmpro_sws_sitewide_sale_id', true ); | |
if ( ! empty( $sitewide_sale_id ) ) { | |
$classes[] = 'pmpro-checkout'; | |
} | |
return $classes; | |
} | |
add_filter( 'body_class', 'add_pmpro_checkout_body_class_sws' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment