breezy breezy - 20 days ago 6
PHP Question

In Wordpress how to add a body class to all interior pages except the homepage

I want to add a class to the body tag to all pages EXCEPT the homepage. Right now I have.

<?php body_class('interior'); ?>


But it adds 'interior' to ALL pages including the home page.

What is the best standard way of adding a class to the body tag to all interior pages except the 'home page'?

Answer

http://codex.wordpress.org/Function_Reference/is_home

<?php if (!is_home()) body_class('interior'); ?>

Unless you mean http://codex.wordpress.org/Function_Reference/is_front_page

<?php if (!is_front_page()) body_class('interior'); ?>