How to get nav to show current_page_parent class when on regular post (not blog), differentiated by category

I found the correct syntax is:

    if ( is_single() && in_category ( '5' )  ) {

However, I solved the problem using this code:

//add category classes to single.php
add_filter('body_class','add_category_to_single');
function add_category_to_single($classes, $class) {
    if (is_single() ) {
        global $post;
        foreach((get_the_category($post->ID)) as $category) {
            // add category slug to the $classes array
            $classes[] = $category->category_nicename;
        }
    }
    // return the $classes array
    return $classes;
}

(or you could try using a plugin such as: https://wordpress.org/plugins/ambrosite-body-class-enhanced/). From there, you can style with css.