WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Dynamic menu highlighting with WordPress menus

[Resolved] Dynamic menu highlighting with WordPress menus

  • blicht454
    Member

    @blicht454

    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?

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Jerry
    Participant

    @phyrax

    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.

    .current-page-ancestor{font-weight:400;}

    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.

    blicht454
    Member

    @blicht454

    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.

    Jerry
    Participant

    @phyrax

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

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] Dynamic menu highlighting with WordPress menus’ is closed to new replies.