Is_search not working on search results page
If what you want is for the else to show up on 404 pages and on search pages but only when the search returns no results, the conditional you need is … if(is_404() || (is_search() && 0 === $wp_query->found_posts)) { // … } else { // … } The difference between that and your code … Read more