"Not Home" Class for WordPress


/ Published in: PHP
Save to your folder(s)

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


Copy this code and paste it in your HTML
  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

You need to login to post a comment.