Custom CSS per page in Wordpress

后端 未结 4 1396
隐瞒了意图╮
隐瞒了意图╮ 2021-01-21 03:35

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 \"kid

4条回答
  •  时光取名叫无心
    2021-01-21 04:22

    I may have over thought this one, but here's my solution.

    The script below automatically gets all the children of a specific parent page and prints the class you need. This solution works great if you don't want to have to update the list of children pages manually.

    This goes in your header.php file:

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

    ?>

    Thanks, and I hope this helps!

提交回复
热议问题