Integrate Google custom search into WordPress blog for a better search experience

0 Flares 0 Flares ×

Is the search functionality on your wordpress blog slow or you do not like the way it does, then you may think of integrating Google custom search into your wordpress blog. Google custom search is very powerful and I am sure you will not be dissatisfied with it. Integrating Google custom search into wordpress blog is very simple and is a job of only 15-20 min. In this article I will explain how to integrate Google custom search into wordpress blog very easily. We have also integrated Google custom search into our blog, for a demo you can enter your search query and press enter and you will see a custom search result.


  Integrate Google Custom search












Prepare your blog to integrate with Google custom search:


Now lets see how you can prepare your blog to integrate with Google custom search, but it would be my sincere advice to test it locally before you make the changes to your live blog to avoid any unwanted mistakes.


First thing that your need to do: The first thing that you need to do is to create a Google account if you do not have one yet, it is free. Now you need to create your Google custom search.


Prepare your Google custom search:


STEP1: Go to Google custom search and click on Create a Custom search Engine and login with your Google account id.

                                   Google Custom Search - Site search and more

STEP2: After successful login enter the fields with correct data as shown below, make sure you enter your own data and click on “Next” button.


Google Custom Search - Create a Custom Search Engine


STEP3: In this screen you need to select the custom layout, just select a layout that suits your site’s look, you can modify it later, click on “Next” button.


STEP4: In this screen you can see the generated code, in the same screen you can find a link as “basics”, click on it. Enter the basic details of your custom search engine, optionally you can enter some key words also, but it is better to leave it blank. Make sure that you select the “Search only included site” in Search preferences at the bottom of the page and save the changes.


STEP5: Click on the “Look and feel” link on the left panel and customize it then save it.


STEP6: Click on the “Get code” on the left panel and select your website’s protocol and specify the search query string as “s” for wordpress and copy the code and keep in with you as it will be used in next steps.

             Google Custom Search


Now your custom search engine is ready to be integrated with your blog. Now lets see what changes you need to do in your blog.


What changes need to be done in wordpress:


Go to your theme directory of your wordpress blog (You can find it in wp-content\themes\[your-theme]). Take a back up of “search.php” file and edit the search.php file to insert the generated Google custom search code. Replace the existing search code with the Google custom search code. You can customize it further more to give a good look and feel. After saving the file access your site and search for something and you can see your customized search result.


Final Tips:


* The generated code can further be customized to give look and feel as you like, you can edit the CSS file generated by Google.

* Monetize your custom search by integrating with your Adsense account.


+Ayodhyanath Guru holds a B.Tech degree in Electrical Engineering and has worked with various prestigious clients in the IT industry and presently working as a Software Engineer. He is a part time blogger and presently authors the Jafaloo.Com blog. Being a tech enthusiast Guru likes to surf the web and blogs about interesting technical topics like How-To guides, freewares, Tutorials, Software, Gadgets, web applications etc. Apart from blogging he likes coding in Java/J2EE and PHP.

You may also like...

0 Flares Twitter 0 Facebook 0 Google+ 0 LinkedIn 0 0 Flares ×