Skip to content

Instantly share code, notes, and snippets.

@kimcoleman
Last active November 15, 2018 18:49
Show Gist options
  • Save kimcoleman/8369505f185ce561278200b698332c59 to your computer and use it in GitHub Desktop.
Save kimcoleman/8369505f185ce561278200b698332c59 to your computer and use it in GitHub Desktop.
Add the 'pmpro-checkout' body class to Sitewide Sales landing pages.
<?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