Forked from gerbenvandijk/Mark parent navigation active when on custom post type single page
Created
March 15, 2018 02:24
-
-
Save harshclimate/9430f13ebc83f94028ea628b859aa997 to your computer and use it in GitHub Desktop.
Mark (highlight) custom post type parent as active item in Wordpress Navigation. When you visit a custom post type's single page, the parent menu item (the post type archive) isn't marked as active. This code solves it by comparing the slug of the current post type with the navigation items, and adds a class accordingly.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Worked great right of the bat! Pasted it in functions.php and custom post types lit up like christmas!