In the members-only forum a user asked:
I want to style the h1.entry-title differently for each parent/child page. So About page, and all its sub pages would have a class .blue-bg, Events Page would have .green-bg, etc., with css as below. I have tried using is(tree) code with conditional body_class but it is not working. Any suggestions?
Below is the sample code using which we can assign different body classes to multiple sets of a Page and all its child Pages in WordPress.
To view the full content, please sign up for the membership.
Already a member? Log in below or here.
Thank you! This is almost there … it is applying the color (.blue-bg) to the entire body though, not the h1.entry-title. How can I apply it only to the .entry-title?
by using this selector:
.blue-bg h1.entry-title
PERFECT! Thanks!