Need to call parent page’s slug as body class
-
Right now I have the code below pulling up the page slug as the body class to control individual page’s style, but once you get to a subpage it doesn’t carry the page parent’s style, which is the goal. I could add the subpage slugs to my css, but if new subpages are added I’ll just have to add them to the css too, which is lame and chunks up and uglyfies my css. Any ideas here? Any info is greatly appreciated. Thanks!
<body <?php if (is_front_page()) { ?> id="home"<?php } else { ?> id="interior" class="<?php echo $post->post_name; ?>"<?php } ?>>
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Need to call parent page’s slug as body class’ is closed to new replies.