I have a menu within the sidebar of my site. When you click on the child element of the menu, the li tag adds a current_page_item class to the li tag.
When you land on the page its the parent page and I want the "Overview" li below to add a current_page_item class like its child pages. Does anyone know how to achieve this?
<?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) {
$parent_title = get_the_title($post->post_parent);
?>
<h3>
Related Pages
</h3>
<ul>
<!-- <li class="current_page_item"> -->
<li>
<a href="<?php echo get_permalink($post->post_parent) ?>">Overview</a>
</li>
<?php echo $children; ?>
<?php } ?>
</ul>
<div class="sidebar-widget">
<?php if(!function_exists('dynamic_sidebar') || !dynamic_sidebar('page-sidebar')) ?>
</div>
Thanks for your help