Skip to content

Instantly share code, notes, and snippets.

@rafaelcavalcante
Last active May 2, 2017 16:56
Show Gist options
  • Save rafaelcavalcante/9c3792a195d76e223b798fae5141b3b7 to your computer and use it in GitHub Desktop.
Save rafaelcavalcante/9c3792a195d76e223b798fae5141b3b7 to your computer and use it in GitHub Desktop.
Wordpress - Display the number of search results
$allsearch = &new WP_Query("s=$s&showposts=-1");
$count = $allsearch->post_count;
echo $count; // print results quantity
wp_reset_query();
// Source: http://www.problogdesign.com/wordpress/3-codes-for-a-far-better-wordpress-search-page/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment