Kcomphlint,
I would like to know how to do this as well, but right now I’m willing to settle for the messier version.
I have a horizontal navigation list like this:
<div id="menu">
<ul id="navlist">
<li<?php if (is_home()) { echo " class=\"current\""; }?>><a href="<?php bloginfo('url') ?>">Home</a> | </li>
<li<?php if (is_page('5')) { echo " class=\"current\""; }?>><a href="<?php bloginfo('url'); ?>/about">About</a> | </li></ul></div>
And a sidebar menu that lists children of a page:
<div id="navibar">
<div class="links">
<ul>
<li>
<?php
if($post->post_parent)
$children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0");
else
$children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");
if ($children) { ?>
<ul>
<?php echo $children; ?>
</ul>
<?php } ?>
</li></ul></div></div>
I want the top-level parent highlighted when I’m on a child page.
Would your messy php code work with this?
Thanks.