Support Forums

Looking for support? You can access the support system via your account.

Forums Forums Search & Filter Pro How to create a message for a failed search

Viewing 2 posts - 1 through 2 (of 2 total)
  • Charley C
    #3027

    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

    Ross Moderator
    #3050

    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

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.