We are used to finding the stuff we need by searching. We want quality results, courtesy of Google. Speaking of search, I will let you in on a small secret about WordPress search but don’t let anyone else know about it – it’s terrible! It is extremely limited. It shows irrelevant results. There are lots of plugins available which does enhance the search results but they don’t match up against a modern search engine. Let’s face, Google is the number one search engine in the globe. Why not use it on your WordPress site. Your users will love it. Google Custom Search Engine (CSE), provided by Google itself will help you to add Google search to your WordPress blog. Today we will show you how to add Google CSE to your WordPress site.
Why use Google Custom Search
You can safely bet on Google to provide you great search results when using Google search. Search results will be based on your content. The default WordPress search relies on complex SQL queries. This offers poor and irrelevant results. Google relies on indexing your content. Whatever it may be, as soon as Google has indexed it, it will show up in search results.
Create Google Custom Search for your WordPress site
Visit the Google CSE page and sign in with a Google account. Click on “Create a custom search engine” button.
You will need to provide your WordPress site address and a name for your custom search engine. Hit the Create button
You will be notified that your custom search engine has been created. You will be presented with three options, get your Google CSE code, view it on the web or customize your search engine. Go ahead, check it out. When done, click “Get Code” button and copy the code.
Adding your Google Custom Search in WordPress
Go to your Dashboard > Appearance > Editor and open searchform.php in the editor. Delete everything in the file and paste the copied code. If searchform.php is not present, then create a new blank file called searchform.php. Upload it to your WordPress root directory using an FTP client or your cPanel file manager.
Save and update the file after pasting the code. Go to Appearance > Widgets. Drag and drop a copy of the default search widget in any widget-ready area of your theme. Congrats, your are now using your very own Google Search.
Note: If your Google search looks odd, you probably need to apply some CSS fix.
Customize Google Custom Search Engine
Go to Google CSE website and edit the search engine you created earlier. In the left-hand panel, click on Look and Feel. By default, search results appear in overlay mode. You can change it under the Layout tab. Play with the settings and find your best match. Under themes tab, you can select from the collection of premade themes. If you want further customization, visit the Customize tab. You can change search font, background colors, border colors. Remember to save your changes by clicking on the Save button once you are done.We hope you have now added Custom Google Search to your WordPress site. Leave us your suggestions and feedback in the comments section below.