Skip to content

Instantly share code, notes, and snippets.

@srikat
Last active May 19, 2017 12:13
Show Gist options
  • Save srikat/e8d6f1d69740ab132352 to your computer and use it in GitHub Desktop.
Save srikat/e8d6f1d69740ab132352 to your computer and use it in GitHub Desktop.
Add 'inner' body class to all inner pages in WordPress.
add_filter( 'body_class', 'sk_body_class' );
/**
* Add "inner" class to 'body' element for inner pages
* i.e., for all pages other than site's homepage/front page.
*
* @author Sridhar Katakam
* @link https://sridharkatakam.com/add-inner-body-class-inner-pages-wordpress/
*/
function sk_body_class( $classes ) {
if ( ! is_front_page() ) {
$classes[] = 'inner';
}
return $classes;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment