How to Add Google Search in a WordPress Site
As you may have discovered, in spite of its phenomenal performance as a blogging platform/CMS, WordPress falls woefully short in the search department. There are other plugins available that will improve your search results, like Amazon CloudSearch in WordPress with Lift or SearchWP. But for those of you who don’t want to install 15 of them to just barely imitate the functionality of modern search engines, there is another option: replace WordPress search with Google custom search. In this tutorial, we will to show you how to add Google Custom Search in WordPress.
Create a Google Custom Search Engine for your WordPress Site
Go to Google Custom Search Engine and sign in using a Google account. Once there, click on New Search Engine and provide your WordPress website’s URL. The URL will also be used as your search engine’s name in your Google Custom Search Engine dashboard. Click on Create button to proceed to the next step.
On the next page, you will see a notification that you have successfully created your custom search engine. You will be presented with an option to add it to your site or get the public URL. To add this custom search engine in your WordPress site click on the Get Code button.
On the next page you will get the code for your custom search engine. Copy the code you will need it in the next step.
Adding Google Custom Search in WordPress
Go to Appearance » Editor in your WordPress admin area and click on searchform.php file to open it in the editor. Paste the custom search engine code in the file. It is alright if this file does not contain anything else and just the Google custom search engine code.
If your theme does not have a searchform.php file, then you need to create one using a text editor like Notepad and upload it to your theme directory using FTP client.
After pasting Google custom search code, go to Appearance » Widgets to drag and drop the search widget into your sidebar.
How to Add Google Search in a WordPress Site
No comments: