I want to use a block element to add some custom content when a search produces no results. I know I can change the no-results.php template, but I would like to make the change without creating a custom template file (I’m using a child theme so this is an option).
Pretty much all the hooks I can use will display whether there are results or no results and there is no location selection for a search with no results. Obviously I could use css to only show the html if there are no results but I’d like to not generate the block unless there are results. Is there an easy way to determine if the block should show without modifying the no-results template?