• I am building a menu with wp_list_pages and am having an issue with the class current_page_item and nested uls. What I want to accomplish is have a style that will show the page the current page the user is on.

    I am using the current_page_item class which is automatically generated by WP. This works good – I can set a style for this and the current page is highlighted in the menu.

    The problem is that all of the children menu items are also highlighted. I just want the top level menu items to be affected.

    Here is the code that WP outputs with ‘Services’ selected
    (And all of the children of ‘Services’ adopt the current_page_item style – which is what I am trying to avoid):

    <ul id="dropmenu">
        <li class="page_item page-item-5 current_page_item"><a href="https://localhost/wordpress/?page_id=5" title="Services">Services</a>
    
            <ul>
                <li class="page_item page-item-7"><a href="https://localhost/wordpress/?page_id=7" title="Financial Management">Financial Management</a>
                <li class="page_item page-item-31"><a href="https://localhost/wordpress/?page_id=31" title="Your Portfolio">Your Portfolio</a>
            </ul>
       </li>
    </ul>

    And I am using this code to highlight the menu item for the current page:
    #dropmenu .current_page_item a {color:#000;background-image:url(images/curr.gif);background-repeat:repeat-x;}

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘wp_list_pages nested structure and class inheritance’ is closed to new replies.