Search Results Count: How To Display The Number In WordPress

StevenWordPress
Advertise Here

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 search.php.

Search for:

<h2 class="pagetitle">Search Results</h2>

And replace it with:

<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!

Learn how I made $36,482 online in the past 12 months.

Simply input your best email below to get started.

Advertise Here

Learn how I made $36,482 online in the past 12 months.

Simply input your best email below to get started.

No thanks, I have enough money