get_body_class

This free code checks the body classes and executes your code if the body class exists.

In this case, the code executes on any page which includes custom-class in the body classes. If so, the header and header markup is removed along with the nav menus and this text is printed in the genesis_header hook position : Replace this output value with you own

To modify this code, replace the value for the $output variable, and replace the actions within the function to add or remove functionality.

You can check for an existing body class or a custom class added using code like this found in many Genesis child theme template files :


add_filter( 'body_class', 'genesis_sample_landing_body_class' );
function genesis_sample_landing_body_class( $classes ) {

    $classes[] = 'custom-class';
    return $classes;

}

If you inspect the element or source code and view the body classes, this is what you’ll find :

body-class

Join 5000+ Followers

Get The Latest Free & Premium Tutorials Delivered The Second They’re Published.