[resolved] Dynamic menu highlighting with WordPress menus (4 posts)

  1. blicht454
    Posted 3 years ago #

    Hi, I was wondering how I could use .current_page_item or .current-menu-item styling for pages that aren't in my dynamic menu (i.e. child pages).

    The menu I'm using was created under appearance > menu. Everything is working fine for top-level pages, but for the child pages, I can't seem to get the current class to work.

    The link is lellabellavenezia.com.

    You'll notice that the current state in the main nav is slightly bolder, but it's not working for an individual product (like this) or for a single blog entry (like this).

    Any ideas?


  2. Jerry
    Posted 3 years ago #

    For some reason your home page uses .current_page_ancestor but the product page uses .current-page-ancestor so I would just add the following to your style.css file, which is proven to work in chrome inspector.


    EDIT: notice the differences between hypens and underscores, I would look into fixing why that happened or you'll be running into this issue quite frequently.

  3. blicht454
    Posted 3 years ago #

    Thanks, that helped.

    .current-page-ancestor worked for the pages and .current_page_parent for the posts

    The classes for the dynamic menus are written automatically, so I have no control over whether it uses hyphens or underscores. Maybe the dynamic menu isn't the best idea.

  4. Jerry
    Posted 3 years ago #

    Hmph, well that's odd, though since it's a WP issue I would imagine it'll be fixed soon.

Topic Closed

This topic has been closed to new replies.

About this Topic