1. I have created a theme by copying twentyeleven default theme.

  2. I have also installed a module Custom Post Type UI and created a custom post type called "Book".

  3. I have gone to Settings -> Reading and set Front page displays to Static page and set my Front Page to a page called Home and my Posts page to a page called News & Press.

  4. I have gone to Appearance -> Menus and created a new custom menu. I put Home, News & Press, and Books (just a static page) pages to my menu item. Under Books menu item I've also added a few Book custom post type posts as children.

Now when I open a Book custom post type page, which is a child menu item of Books page, the menu highlights News & Press as the custom post type's parent, as well as the Books page.

I don't want this behavior, as highlighting the News & Press as the parent of a Book custom post type is completely wrong.

I have done a lot of searching around, and seen a lot of fixes that suggest using jQuery, and also some php fixes which both use menu item id's which is just a bandaid fix, and not something that I would consider an actual fix to the problem because what about people who browse with javascript off, and if I used the PHP fix, then what if the menu item id's changed? I wanted to come here and see if anyone has actually managed to fix this broken behaviour with custom post types menu parent/ancestor highlighting.

  • It's about your nav menus. You should be sharing this code parts of your theme and improve the question. – kaiser Sep 21 '12 at 16:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.