ID)); $current_post_type_slug = $current_post_type->rewrite[slug]; // Getting the URL of the menu item $menu_slug = strtolower(trim($item->url)); // If the menu item URL contains the current post types slug add the current-menu-item class if (strpos($menu_slug,$current_post_type_slug) !== false) { $classes[] = 'current-menu-item'; } // Return the corrected set of classes to be added to the menu item return $classes; } ?>