Wordpress Web Development

How to Customize the Search Page in WordPress?

Rushik Shah User Icon By: Rushik Shah

If you have a WordPress website and are looking for a more from your search options available on the website then this article is for you. It is possible to customize your search options in WordPress; which you will come to know in detail by the end of this article.

All you need to do is to simply follow the steps mentioned here and you will end up with a good search form and even a good search results page.

Placing the Search Form:

To start with login to the admin section of your WordPress website and navigate to Appearance >> Widgets from the admin menu.


  • You will find a Widget called ‘Search’ amongst the many widgets that are displayed on the screen. You can drag this widget on to one of the sidebars in use.

Widgets Sidebars

  • For example there may be sidebars like primary sidebar, or content sidebar or even the footer one. ( could be different in a customised template)
  • You can specify the title for the search form to be placed in the sidebar and click save to save the settings.
  • Now preview your WordPress website in the browser and you will find the search form present on the browser.

The Search Results Page:

Again from the WordPress admin section select the menu option Appearance >> Editor.


Here you will find a list of files on the right side of your screen. You need to look for the one with the title ‘Search Results’, which is the file with the name ‘search.php’. The file contains the template for the search results page.

Search Result

  • It is possible for you to change the template of this file from the top right corner of your screen. The default template would be your current template, although you are free to change the template of this individual file to suite your requirements.
  • However if you wish to make the customizations yourself the page is also loaded in an editor on the left side of the screen upon selection.
  • It is best to first make a backup of the file you are about to modify so that you have something to fall back too in case of an error.

The file is now ready for you to customize. it is essentially PHP code. For example if you wish to remove the section which generates comments you can simply delete the following code from the page:

<?php comments_popup_link(‘No Comments’, ‘ 1 comment’, ‘% comments’, ‘comments-link’, ‘Comments are closed’); ?>

It is also possible for you to change the number of search results like below:

  • Place this code: <?php query_posts(‘showposts=#’); ?>
  • above this code: <?php if(haves()) :while (have_posts()) : the_post(); ?>

and replace the # with the number of posts of our choice.

In addition to which you can even remove the footer by simply removing the piece of code mentioned below:

<?php get_footer(); ?>

You even have the option of displaying the number of results by making a few modifications like change the code below:

<h1>Search for: “<?php the_search_query(); ?>”</h1>


<h1>Search for : “<?php /*Search Count*/ $allsearch = &new Wp_Query(“s=$s&showposts=-1″); $key = wp_specialchars($s,1); $count = $allsearch->post_count; _e(”); _e(‘span>’). echo $key; _e(‘</span>’); _e(‘- ‘); echo $count . ‘ ‘ ; _e(‘articles’); wp_reset_query(); ?> </h1>

After you do make your required changes you need to save the file by hitting the ‘Update File’ button.

The above might be just what you are looking for, however it is not very simple to do so and does some knowledge of programming. The instructions mentioned above are very specific and to the point and you could pull it off it you are slightly IT Savvy too. But if you are afraid of messing something and not sure you will be able to set it right it is best you leave this to the professional WordPress Web Developers like Alakmalak.

Alakmalak is involved in WordPress Web Development since many years now and are very much capable of handling all of yours tasks.

Why Choose Alakmalak As a Your Growth Partner?

Looking Outsource Website Design & Development Work?

Alakmalak is a Web Development Company In India that offers services for several technologies. There have been around for a very long time and have developed over 2500 projects for clients all around the world. They have highly skilled web developers with a great deal of experience.

  • How to customize the search page in WordPress?

What’s Next ?

I know after reading such an interesting article you will be waiting for more. Here are the best opportunities waiting for you.