I'm pulling my hair out here trying to figure this out. I'm developing my first custom WP theme, and for some reason, I cannot get the font color of the_content() to change specific to the page I'm on.
On my home page, I want it to be white. On my single.php page, I want it to be black.
I figured simply wrapping it in a div with a different class name than the one on the home page would work, but when I change the color attribute in my css file for the_content() on my single.php file, it affects the_content() on the home page, and vice versa!
I tried typing in style = "color:black" specifically on the div wrapping it on single.php, but that would not work either.
Is there some kind of trick to this? There has to be something I'm missing. Why would styling for a completely different class that's not even present on the page be affecting the styling?
Try this one, Target the_content block/div using page_id class in css. Like, if( is_page( ID ) ) { Do something fun. }
Ref: https://www.skyverge.com/blog/apply-changes-single-wordpress-page/
ex. CSS style: body.page-id-2 .content{color:red;}