• I’m attempting to style a menu using wp_list_categories. Worpress naturally creates the current-cat and current-cat-parent classes, so that’s easy to style. What I want is to carry this through to the child’s child as well as an actual post (single) that is beneath the category, no matter how far beneath.

    To put this another way, let’s say I have a category/post hierarchy like this:

    • Articles
    • Health
    • Anti-Aging
    • How to Stay Young

      No matter which category, or even if I click on the article, I want the word “Articles” to be styled to show a “current” state.

      Any idea how I could do this dynamically?

      Thanks,
      Gary

    Viewing 2 replies - 1 through 2 (of 2 total)
    • Thread Starter gw468

      (@gw468)

      Ok, one more bit of info. I’m also using pages in my nav menu. For pages this is easy. wp_list_pages automatically adds the class current_page_ancestor to the li tag for subpages, regardless of how many generations deep. How can I make Categories work the same way? Why can’t it just automatically add current_cat_ancestor to the li? Is this possible, or anything similar?

      Thanks,
      Gary

      Hi

      I used this plugin on a couple of sites
      https://www.webspaceworks.com/resources/wordpress/31/
      I was able to tweak the plugin code a little to accomplish what I wanted. Take a look and see if it fits your needs.

    Viewing 2 replies - 1 through 2 (of 2 total)
    • The topic ‘Using wp_list_categories, how to set a current state if a grandchild is showing?’ is closed to new replies.