custom post types – Highlighting wp_nav_menu Ancestor Class w/o Children in Nav Structure? – WordPress Development Stack Exchange

add_filter('nav_menu_css_class', 'current_type_nav_class', 10, 2 ); function current_type_nav_class($classes, $item) { $post_type = get_query_var('post_type'); if ($item->attr_title != '' && $item->attr_title == $post_type) { array_push($classes, 'current-menu-item'); }; return $classes; }

This snippet allows you to check if the current menu item has a parent, and various other things to add classes for formatting WordPress navigation menus.

And this link outlines how to check if an item has a parent page.

http://css-tricks.com/snippets/wordpress/if-page-is-parent-or-child/

via custom post types – Highlighting wp_nav_menu Ancestor Class w/o Children in Nav Structure? – WordPress Development Stack Exchange.