Is there a conditional tag (or a similar concept) that can tell me wether the search returned posts or not?

1 Answer 1

global $wp_query;
echo $wp_query->found_posts;
  • Or if( have_posts() ) should pretty much do the same, ie. tell you if there are more than 0 posts returned in the query.
    – t31os
    Jan 22, 2011 at 10:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.