CSS body class conflict

This has caused problems in the past. A body class name conflicts with a class name used elsewhere.
If we’re using the function body_class(), WordPress will add the page slug to the body class.

For example, we are displaying programs and are using .programs class to style individual programs in our page in a php template file. Didn’t realize right away that WP also adds the programs class to body tag since that is the page name.

Went to the inspector and looked closer and found the cascading issue.

Either have to rename .programs to .programs-list or something that doesn’t conflict, or modify or not use body_class() function.

I know this is a simple issue, but it’s come back and bit me several times before.


by Norm Euker