Skip to content

Instantly share code, notes, and snippets.

@nicmare
Last active December 13, 2022 14:22
Show Gist options
  • Save nicmare/3354ce2d634022ca5372d123394c4fca to your computer and use it in GitHub Desktop.
Save nicmare/3354ce2d634022ca5372d123394c4fca to your computer and use it in GitHub Desktop.
checks if header and/or footer is disabled on page and adds a body class
<?php
function add_blocksy_bodyclasses($classes){
if($blocksy = get_post_meta(get_the_ID(),"blocksy_post_meta_options",true)){
if(isset($blocksy["disable_header"]) && $blocksy["disable_header"] == "yes")
$classes[] = "blocksy-header-disabled";
if(isset($blocksy["disable_footer"]) && $blocksy["disable_footer"] == "yes")
$classes[] = "blocksy-footer-disabled";
}
return $classes;
}
add_filter('body_class','add_blocksy_bodyclasses');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment