Search Results Count: How To Display The Number In WordPress
Everybody knows that WordPress search is not one of the strongest side of our preferred CMS. One of the steps you can take to improve your visitor’s experience is to display the number of results returned by a given research.
In order to display the number of search results, you need to open your search template file
<h2 class="pagetitle">Search Results</h2>
And replace it with:
Learn how I made $33,543 online in the past 12 months.
Simply input your best email below to get started.
<h2 class="pagetitle">Search Results for <?php $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>
That’s all folks!