For a menu which has only top-level links to custom post type archive pages, how can I add the
.active class to the top-level item when viewing that post type's single?
There's lots of similar questions on WPSE (like this or this), but none seem to address my specific question and make use of
.current-menu-ancestor (and associated) classes, which don't appear on my menu (as I assume because the single posts aren't part of the menu list structure).
The only way I can think to do this is check the current post type against the slug, but it feels a bit hacky (and doesn't allow for url rewrites, etc).