Good Morning All,
I have created a different background and a few other images for certain pages within our site. Currently the below code is working well with the "kids" page on our site.
<body<?php if ( is_page(array('kids'))) {
echo ' class="kids" '; } ?>>
I am trying to figure out how to go about adding that same CSS to other pages"under" the kids page. So if you go to kids/block-party, how would I go about adding it to the code to call that special CSS?
I have tried the below
<body<?php if ( is_page(array('kids, kids/block-party'))) {
echo ' class="kids" '; } ?>>
the comma does not seem to register for some reason.
This is a wordpress run site.
Thanks
Another option is simply replacing
<body>
with
<body <?php body_class(); ?>>
Then you can target it it via css as follows:
body.page-id-2, body.parent-pageid-2 { background-color: red; }
Where the ID is the ID of the page/parent-page you are targeting. This will keep your template clear of logic, and allow you the same customization options your current method is using.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With