Created
June 4, 2021 19:24
-
-
Save tigredanky/a1e5d925428532e9d0d95eec8881b3ce to your computer and use it in GitHub Desktop.
WordPress Functions.php | Add Body Class By Page Template
This file contains 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
<? | |
// BODY CLASS FOR NOLOGO PAGE TEMPLATE | |
add_filter( 'body_class','nologo_body_class' ); | |
function nologo_body_class( $classes ) { | |
if ( is_page_template( array( 'page-nologo.php', 'page-empathology.php', 'page-resilience-reboot.php' ) ) ) { | |
$classes[] = 'nologo'; | |
} | |
// add body class for course module | |
if ( is_page_template( array( 'page-empathology.php', 'page-empathology-v2.php' ) ) ) { | |
$classes[] = 'course-module'; | |
} | |
// add body class for course module | |
if ( is_page_template( array( 'page-template-footer-only.php'/* , 'page-empathology-v2.php', 'page-prosperity-pattern.php', 'page-soul-speak.php' */ ) ) ) { | |
$classes[] = 'footer-only'; | |
} | |
return $classes; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment