WordPress comes with a default search feature, which works reasonably well for very basic sites.
Many users, however, find that the default search has some shortcomings, especially for larger sites with a variety of content types.
For many queries, the baked-in WordPress search doesn’t find or display the appropriate results. This can become more and more frustrating as you build up your site with more and more content.
Many site owners find that they need more robust capabilities than the default WordPress search can provide. Fortunately, there is an extremely powerful search engine called Google, which you must have heard of.
Why you should use google custom search engine on your website?
There are several benefits of using google custom search engine into WordPress. Here are some –
- It uses Google Search algorithms which are the best at showing relevant results.
- Google Custom Search Engine is free to use.
- Number of themes , layouts and colors are available to customize the design of search box.
- Its much faster than the default WordPress search.
- You can configure it to show the results from your one or more websites. In this way , its helpful in increasing traffic to all your sites.
- It gives an insight about what your visitors are looking for as google keeps track of the search queries and thus it adds values to analytic data.
- When someone search something using google CSE , your server resources remain free as it is now a burden of google to provide the relevant and precise results.
So these were some advantages of google CSE over Default WordPress search. Lets discuss about creating, adding and customizing the google custom search engine box to a WordPress site:
Creating Google Custom Search Engine for your WordPress site
- Go to Google Custom Search Engine and sign in using any of your google account.
- Click on New Search Engine and provide all the information as shown in the picture below.
Click on Create button to proceed to next page. On the next page you will get a notification that you’ve successfully created your custom search engine.
Click on Get Code button and you will get a code on the next screen. Copy the code . Next step is to add this code to you WordPress site.
Adding Google Custom Search Engine to a WordPress site
Go to appearance>>Editor in your WordPress dashboard and find the file Searchform.php as shown in the picture below . If its not there then create one using notepad and upload in theme directory using FTP client.
- Paste the code(google custom search engine code) into searchform.php and click on Update button.
- After saving the searchform.php file , go to Appearance>>Widgets to drag and drop Search widget into sidebar, footer or where ever you want to show the Custom Search Engine on your website.
- You are done. Now you are ready to customize it according to color scheme of your website.
Customizing Google Custom Search Engine
You don’t need to do any editing work in your theme files. Go back to Google Custom Search Engine website and all the changes you make there will be applied to the Search Box on your site.
- Go Google Custom Search Engine website and click on search engine you created in first step.
- Click on Look and Feel and select the theme.
- There are a lot of other options (like color of outer lining and background of search engine box etc) for customizing and designing the search engine according to the color scheme of your website and all are pretty self explanatory . You can see the changes happening live in sidebar.
Once you are done with customizing , all the changes you made will also be applied and visible on your WordPress site and your visitors will never have bad experience with the searching ever again.