I have a custom searchbox that only searches a particular custom post type. On the results page I have modified seacrh.php to display the results slightly differently.
Mainly the title is different.
<?php if ( 'wpdmpro' == get_post_type() ) : ?> <h1 class="title">Documents Search</h1> <?php else : ?> <h1 class="title">Search</h1> <?php endif ?>
This works when there are some rsults, but fails on no results and displays the default title?
Why is the confitional failing. the url of the results page shows that the post type is still relevant?
Read more here:: Ignores post_type when no results