Skip to content

Instantly share code, notes, and snippets.

@anthonycole
Last active December 18, 2015 02:29
Show Gist options
  • Save anthonycole/5711755 to your computer and use it in GitHub Desktop.
Save anthonycole/5711755 to your computer and use it in GitHub Desktop.
Add a class to every page that isn't a homepage in WordPress.
<?php
// put this in your functions.php file.
add_filter('body_class', 'five15_body_classes');
function five15_body_classes($classes) {
if( !is_front_page() )
$classes[] = 'not-home';
return $classes;
}
@five15design
Copy link

damn that looks straight forward - dumb obvious question what in the css am i calling that class?

all i'm doing is post title justified right on front page, but on post page i want it justified centre. Reason being on front page, feature 3 posts have feature image justified left.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment