How to add seperate classes to no-search-result and found-search-result pages on wordrpess search - is_search()

I want to add seperate body classes for no search result and found search result pages on wordrpess search.

I used that code but it isn't working - what's the error here and what is the solution

add_filter( 'body_class', 'custom_class', 1 ); function custom_class( $classes ) {
    if ((is_home()  !is_front_page()) || (is_search()) || is_tag() || is_author()) {
        $classes[] = 'archive';
    }
    if (is_singular('page') || is_404() || (is_search()  0 === $wp_query-found_posts )) {
        $classes[] = 'single';
    }
    return $classes; }

Topic body-class functions php Wordpress search

Category Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.