Assigning div ids to pages and their children
-
I’ve been trying to figure out a way to assign particular header div ids to particular pages. I want my div id to not only be assigned to a particular page, but also to all of its children. In order to assign the div id to a page, I’ve used the following code:
<?php if (is_home() ) { ?> <div id="header"> <?php } else { ?> <div id="<?php echo $post->post_name; ?>">
The way it works, then, is that I have a div id with the same name as the page (page name = example, div id entry in CSS = #example). This has been working extremely well.
My question is, does anyone have a suggestion for how to set it up similarly, but have all of the page’s children recall the div id of their parents? (page’s parent = example, therefore page’s id recalled = #example) I’ve been trying to do this through using page_parent, but I just simply can’t figure it out!
Thanks so much!
- The topic ‘Assigning div ids to pages and their children’ is closed to new replies.