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?
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?
You must be logged in to post a comment.
Try it:
Or this:
The filter
body_class
can be used for this.Please use the
body_class
filter to add any class to the body tag in WordPress.Add the below code to your functions.php file.
Add class to the body tag for all the pages.
Exclude Home Page