Created
December 18, 2014 04:11
-
-
Save wpspeak/d2251398d0c9c06ef404 to your computer and use it in GitHub Desktop.
Conditionally add custom body class in WordPress
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_action( 'body_class', 'wpspeak_conditional_body_class'); | |
function wpspeak_conditional_body_class( $classes ) { | |
if ( is_page( array( 'page-1', 'page-2', 'page-3' ) ) ) { | |
$classes[] = 'my-custom-page'; | |
} | |
return $classes; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment