Hello All,

I've produced another background a couple of other images for several pages inside our site. Presently the below code is working well using the "kids" page on our website.

<body<?php if ( is_page(array('kids'))) {
echo ' class="kids" '; } ?>>

I'm trying to puzzle out how to pull off adding that same CSS with other pages"under" the children page. If you visit kids/block-party, wouldso would Time passes about adding it towards the code to call the perfect CSS?

I've attempted the below

<body<?php if ( is_page(array('kids, kids/block-party'))) {
echo ' class="kids" '; } ?>>

the comma doesn't appear to join up for whatever reason.

This can be a wordpress run site.


I might have over thought that one, but here's my solution.

The script below instantly will get all of the kids of a particular parent page and prints the course you'll need. This solution is effective if you won't want to need to update their email list of kids pages by hand.

It goes inside your header.php file:

    //set page id 
            $page_id = '98';

           //get page's children 
    $children = get_pages('child_of='.$page_id);
    foreach($children as $child){
       $children_ids = $child->ID;

    if(is_page($page_id) || is_page($children_ids)){
       echo 'class="kids';


Thanks, and that i hope this can help!

Determined i desired the ' ' around them

<body<?php if ( is_page(array('newsletter-1', 'newsletter-2', 'newsletter-3'))) { echo '   class="myclass" '; } ?>>

An alternative choice is just changing



<body <?php body_class(); ?>>

You'll be able to target it's via css the following:

body.page-id-2, body.parent-pageid-2 { background-color: red; }

In which the ID may be the ID from the page/parent-page you're focusing on. This can keep the template obvious of logic, and permit you an identical personalization options your present technique is using.