Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm trying to figure out how to highlight the parent nav of a page and becoming stuck.

I've seen something like this :

<li <?php if(is_page('services')) { echo 'class="current_page_item"'; } ?> >
     <a href="#">Services</a>
</li>

I have different post types going on and I've split each post type into a page, the problem begins when I click down into the "services" tab and click a "service request" the blog navigation highlights instead of the services one.

How can I fix this? I don't mind using PHP or CSS for this as the site is for myself.

share|improve this question
    
please post whatever code you are using to create your nav –  Michael May 13 '13 at 20:32
    
just using the standard wp_nav at the moment. <?php wp_nav_menu( array( 'container_class' => 'menu-header', 'theme_location' => 'primary' ) ); ?> –  user1888564 May 13 '13 at 20:50
    
if you use the walker you do need to add any PHP to highlight current page item, there are CSS classes made for that : .current-menu-item {} and current_page_item {} –  JMau May 14 '13 at 12:10
    
have tried all variations of current_page_item etc the ancestor class is working at the moment for parent pages... –  user1888564 May 14 '13 at 20:17
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.