body_class()function operates in nearly the exact same manner as the
post_class()function that was introduced in WordPress 2.7. The only differences are the classes it generates. The
body_class()function will generate the classes mostly based on where your viewer is on your site.
post_class() when it was introduced in WordPress 2.7. This
body_class() new function is a great addition for WordPress theme designers. Well, actually it’s not only for WordPress Theme designers, but it’s more for those who want to have/do more on the template. We can have some automatically generated HTML tags like these:
See the patterns? Jump to Nathan Rice’s blog posts to read more details. In short, if you want to use this function, just modify your
tag. Change it into
>. That’s it!