Posted By

ethicka on 03/28/11


Tagged

css wordpress


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

ignacio


"Not Home" Class for WordPress


 / Published in: PHP
 

This adds the class "not-home" to your body_class in Wordpress. Handy if you want to reset CSS from the index page.

  1. function not_home_class($classes) {
  2. global $post;
  3. if(!is_home()) $classes [] = 'not-home';
  4. return $classes;
  5. }
  6. add_filter('body_class', 'not_home_class');

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: ignacio on September 28, 2013

Awseome function, thanks! I would add !isfrontpage() as well, when using a particular page as home.

You need to login to post a comment.