WordPress 101: Tips, Tricks, & Hacks
WordPress as a Content Management System provides a unique opportunity. What is this opportunity you might ask? The opportunity is to democratize the ability to create on the internet. With WordPress and its industry-leading ease of use and feature-packed functionality, it enables everybody with an idea or passion to create an amazing website on the internet.
Today even a person with a limited amount of knowledge regarding how to build code in HTML and CSS can create a beautiful and robust website. With the rise of the internet and the wide acceptance and increase in demand for WordPress has resulted in the digital empowerment of millions.
The prime example of the above statement is the rise of bloggers amidst the common public. More and more people are getting into creating content for netizens to read and enjoy. But this rise in the number of bloggers/online content creators has also given rise to a modern issue.
That issue is the inability to successfully search and index your website’s content. Therefore to help bloggers and novice WordPress, we have a hack that will help you search and index your WordPress website’s content.
How To Show The Number Of Search Results Found?
The following steps are of a hack that will enable you to show the number of search results found:
Step 1 – Add the below code snippet to your search.php file:
<h2 class="pagetitle">Search Result 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>
Step 2 – Save your search.php file with the new changes