Sometimes it does happen that when a search is done on your blog, WordPress does not return back any result. At that time, using the following snippet you will be able to display the number of results in WordPress Search. In order to achieve this, all you have to do is to find a file name search.php and locate the following:
1 | <h2 class="pagetitle">Search Results</h2> |
Now, simply replace it with to:
1 2 3 4 5 6 7 8 9 | <h2 class="pagetitle">Search Results for <?php /* Search Count */ $allsearch = &new WP_Query("s=$s&showposts=-1"); $key = wp_specialchars($s, 1); $count = $allsearch->post_count; _e(''); _e('<span class="search-terms">'); echo $key; _e('</span>'); _e(' — '); echo $count . ' '; _e('articles'); wp_reset_query(); ?></h2> |
Snippet Source/Credit: ProBlogDesign