Forums

[resolved] wp_nav_menu() - no current-menu-item on subpages (2 posts)

  1. dotzoki
    Member
    Posted 9 months ago #

    I have custom post type "thought". I created menu with Thoughts item pointing to archive (http://site/thought). When I'm on archive the wp_nav_menu() knows (adds current-menu-item class) where I am. When I go to http://site/thought/somepost (so I'm on single-thought.php) it doesn't add current-menu-item class to li item (Thoughts menu item) in navigation.

    Shouldn't wp_nav_menu mark all subpages too ?

  2. dotzoki
    Member
    Posted 9 months ago #

    Well, found solution for it. For anyone with same problem the solution is posted here. Selected URI gets class parent_url, so use that in css style - but you can change the name of the class into whatever you wish.

    If there is better or official solution, please let me know.

Reply

You must log in to post.

About this Topic