- This topic has 1 reply, 2 voices, and was last updated 11 years, 6 months ago by .
Viewing 2 posts - 1 through 2 (of 2 total)
Viewing 2 posts - 1 through 2 (of 2 total)
These forums are now closed and remain for historical purposes.
None of the content applies to the new version 3. For support, get in touch via our contact form.
Forums › Forums › Search & Filter Pro › How to create a message for a failed search
Hey Ross,
Is there a way we can create a custom message when a search does not produce a result (say if the user picks too many categories that don’t match a result)? Right now it just shows a blank page.
It would be great to have the site say something like “No results matched your search criteria. Please try again.”
Thanks!
-Charley
Hey Charley
In your template you can add something like:
global $wp_query;
$total_results = $wp_query->found_posts;
if($total_results==0)
{
_e('Sorry, no posts matched your criteria.');
}
There are other examples in here:
http://codex.wordpress.org/The_Loop