WordPress.org

Ready to get started?Download WordPress

Forums

Code to generate current-cat-parent? (2 posts)

  1. xiabolai
    Member
    Posted 4 years ago #

    Hi,

    I've searched and can't find the answer for my situation.

    I have a category dropdown menu item, but cannot seem to get the code to generate "current-cat-parent" for the parent menu item when a submenu item is clicked.

    I want to do this so I can highlight the parent menu item when a submenu child is clicked.

    Here's my code:

    <li class="cat-item">
    <a href="#">Work</a>
    <ul class="children">
    <?php wp_list_categories("exclude=$blog_ID&title_li=");('orderby=name&title_li=');
    $this_category = get_category($cat);
    if (get_category_children($this_category->cat_ID) != "") {
    echo "<ul>";
    wp_list_categories('orderby=id&show_count=0&title_li=
    &use_desc_for_title=1&child_of='.$this_category->cat_ID);
    echo "</ul>";
    }
    ?>
    </ul>
    </li>

    I think I have the right css, but because the "current-cat-parent" code isn't being generated when I click on a subcategory, the css can't style the parent menu item.

    Any help would be greatly appreciated!

  2. DennisvanHouts
    Member
    Posted 4 years ago #

    I have the same problem, any solutions?

Topic Closed

This topic has been closed to new replies.

About this Topic