Last active
May 2, 2017 16:56
-
-
Save rafaelcavalcante/9c3792a195d76e223b798fae5141b3b7 to your computer and use it in GitHub Desktop.
Wordpress - Display the number of search results
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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