Can't Add Body Class for /blog/ Archive Page

Hello,

I’m using Sage 8.5.0.

I 'm using this code in my functions.php :

function custom_class_archives( $classes ) {
    if ( is_archive() || is_page(964) || is_page('blog') ) {
        $classes[] = 'stream';
    }
    return $classes;
}
add_filter( 'body_class', 'custom_class_archives' );

It’s working for my CPT, tag archives (‘stream’ class getting added to ). But it’s not working for the blog page (whether I use blog page’s ID or slug).

What could be the reason?

Does the blog page have a title of ‘blog’, and is it the same page ID 964? You could set the home page to use your latest posts and use is_front_page() to start diagnosing at least.

is_home is the conditional to use for the blog page (rather than is_page('blog')) if that’s what you’ve set in your reading settings

https://developer.wordpress.org/reference/functions/is_home/

Uh oh. I should have figured that out myself.

Thank you Ben! It worked. Two lunches on me now.