I did it. Now, the highlighting works for both “Home” and “Blog” because they are receiving the proper body class. How do I accomplish this with a static page on “Home” and moving my posts to “Blog?” Does this require extra PHP?
I just installed a fresh version of Starkers, only copying over the style.css and header.php. In Starkers, they differentiate between header.php and html-header.php. So, the only things I copied over were styles and the menu basically. And it is still not giving me a body class for Blog. You can see here for yourself. So, I do not know what is causing it.
Edit #1: I just removed style.css and it is still not giving me a body class. So it has to be something in the header.php. Hrm. Let me remove that and see if it does anything.
Edit #2: Nope. It still does not have a body class even if I replace header.php. Suggestions? Do I need to reinstall WordPress in its entirety?
Wait, wait… the `body_class()` is a WordPress function. It has nothing to do with CSS file. It simply outputs page, post, environment details to `body` html element so that you can target them in your style sheet. These “classes” are predefined by WordPress.
But something is keeping it from producing a body_class() for Blog, correct? So, how do I go about figuring this out? Sorry, that escalated quickly. I just hate to think something is fundamentally wrong with code that I had no hand in to begin with.
It is a basic Starkers theme with no custom templates. And I do not know what filters/hooks are, so I doubt that would be the case. I have only added one PHP function to functions.php, which I promptly commented out when this whole situation started.
1. Deactivate all of your plug-ins (reload the page, see if it works)
2. Then turn on plug-ins one-by-one, going back and refreshing after each activation to see if it works. This could be plug-in issue…
Okay, I replaced the wp-admin and wp-includes, no luck thus far. I will read the article now.
Edit: I read the article. In order for me to use that article’s method, I would first need a body class, which I do not have. I find it very strange that every page is producing an unique body class except for /blog/, simply because I am using a static page for home. This is very frustrating.