not sure if this is programming enough or if it should go to superuser, which is not programming AT ALL. I leave it to the mod to decide.
I created a menu using get_pages() and specifying the parent id. This parent id has children and sub-children and sub-subchildren. I need each of these (sub)children to have the parent id displayed, as this menu sits in the header.php file. So it will be included for all pages no matter their ancestry, and i would like that their section main item receives a specific class "currentlyActive".
The code i made ony works for children, not for sub/ sub-sub children
<li id="infographieButton" <?php echo ($post->ID == 5 || $post->post_parent == 5)? 'class="currentlyActive"': ''; ?>>
<a href="<?php bloginfo('url') ?>/infographie/" class="menuHeader"><span>Infographie</span></a>
<ul id="dropdownmenuInfographie" class="submenu">
<?php
$pages = get_pages('child_of=5&parent=5&sort_column=menu_order&sort_order=asc&title_li=');
foreach($pages as $page) {
?>
<li <?php echo ($post->ID == $page->ID)? 'class="current_page_item"': ''; ?>><a href="<?php echo get_page_link($page->ID) ?>"><?php
echo $page->post_title;
?></a></li>
<?php
}
?>
</ul>
</li>
I'm a bit puzzled on how to achieve that in wordrpress. Any suggestion is welcomed!