-
I have created a theme by copying
twentyeleven
default theme. -
I have also installed a module Custom Post Type UI and created a custom post type called “Book”.
-
I have gone to
Settings -> Reading
and setFront page displays
toStatic page
and set my Front Page to a page calledHome
and my Posts page to a page calledNews & Press
. -
I have gone to
Appearance -> Menus
and created a new custom menu. I putHome
,News & Press
, andBooks
(just a static page) pages to my menu item. UnderBooks
menu item I’ve also added a fewBook
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.