WordPress:设置特定模板的主体类

I created a specific template for one page only = I don't want it to be listed in the admin section. So I removed the "Template name" from the comment and let WP figure it out by the slug of the post. That works. Now I would like to assign a custom body class for this template only (as I do with every page) in my functions file:

function cc_set_body_classes($classes) {
    switch(true) {
        case is_page_template("page-about-us.php"):
            $classes[] = "about-us";
            break;
    }

    return $classes;
}
add_filter("body_class", "cc_set_body_classes");

Now this would obviously work just fine if it wasn't a specific template without the Template name. Is it possible to figure out the template name if no Template name is specified in the comments? How should I do it? Thanks a lot!

You could always check the page slug (since that's what you've used to define the template name in the first place). Something like the following should work:

function cc_set_body_classes($classes) {
    if ( get_queried_object()->post_name === "about-us" ) {
        $classes[] = "about-us";
    }

    return $classes;
}
add_filter("body_class", "cc_set_body_classes");