WordPress & PHP help
-
This is my current code:
<body <?php if (is_front_page()) { ?> id="home"<?php } else { ?> id="interior" class="<?php echo $post->post_name; ?>"<?php } ?>>
Which gives me an ID of home if it’s the front page and an ID of INTERIOR if it’s an interior page. Then it assigns a class of the page’s slug.
I would love to assign the body tag a class of the PAGE SLUG if it’s a top level page, the PARENT PAGE SLUG if it’s a second level page or the ANCESTOR PAGE SLUG if it’s a third level page.
Any ideas? I’m new to PHP, and barely understand it, but would there be another if statement? And what’s the template tag for a parent and ancestor page’s slug?
Any and all help is appreciated…
-Patrick
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘WordPress & PHP help’ is closed to new replies.