Last active
August 29, 2015 14:26
-
-
Save cjkoepke/c439025a5286d91e1553 to your computer and use it in GitHub Desktop.
Apply multiple custom classes to the body tag with the body_class filter.
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 | |
//* Do NOT include the opening php tag | |
add_filter( 'body_class', 'ck_custom_body_classes' ); | |
function ck_custom_body_classes( $classes ) { | |
//* Create an empty value (or add a default to be applied everywhere) | |
$classes[] = ""; | |
if ( is_front_page() ) { | |
$classes[] = "front-page"; | |
} | |
if ( is_page_template( 'page_blog.php' ) ) { | |
$classes[] = "blog-page"; | |
} | |
return $classes; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment