Archived topic
Custom Post Type - Current Page
4 replies · Started by antware on October 11, 2015
Hi Tom
Am using GP with a child theme for a new project I'm working on.
Have created several Custom Post Types and when I go to a Single Custom Post Type, the News button (I assigned my News page to list my Blog entries) on the menu displays as the current page. So in other words the Theme is seeing my Custom Post Type as a regular Post.
I don't want the News button to be "highlighted" for Custom Post Types when I'm browsing a Custom Post Type but definitely for Normal Post Types, when I'm viewing a normal post.
Any idea as to how I could do this?
Hi Antony. I don't know that there is a "one size fits all" fix but here are a couple of related posts that might help get you started:
https://generatepress.com/forums/topic/highlight-in-menu-nav/
https://generatepress.com/forums/topic/menu-item-forum-thinks-it-is-a-child-of-item-blog/
https://generatepress.com/forums/topic/menu-highlight-problem/
This is kind of annoying WordPress issue.
This function works: https://gist.github.com/generatepress/f5e4f6d1795cf6bb4c6a
You would just have to replace this line:
case 'forum':
with
case 'yourposttype':
Thanks Thomas, that resolved it.
Thanks too to bdbrown, for your contribution.
Glad we could help :)
