Search
Close this search box.

How to Add Google Custom Search To WordPress

[updated_on]
Share this post:

As a blogging platform and CMS, the efficiency of WordPress is well documented. However, when it comes to searching facilities, WordPress doesn’t seem too special to a lot of users.

Of course, there are a lot of plugins available to improve this particular aspect of WordPress, but if you are one of those who don’t want to use plugins, this tutorial is going to take you through the necessary steps of installing the Google Search facility into your WordPress site. So stick with me for the rest of this article and we’ll get Google Search into your website.

Creating a Custom Search Engine With Google

In order to generate the search engine for your site you need to have an account with Google. I am assuming that you already have a Gmail account . If not, please create one and sign in to your account to use the Google Custom Search feature.

I am moving to the next steps now. We need to go to the Google Custom Search Engine (https://www.google.com/cse/). The page should look similar to this:

Initial Google Custom Search sign up page
The page where you sign up for Google Custom Search will look similar to this.

Click on the big blue button that says “Create a custom search engine”. The new page should resemble the following image.

Add Google Custom Search Creation Page
The page where you add Google Custom Search will look something similar to this.

In the Sites to Search box, provide the name of your website. You may also provide a specific page address that you want to search with Google.

Add Google Custom Search Info
This is how the page where you add Google Custom Search info will look.

You can provide your search engine a name as well. Once you are done, click on the Create button.

Add Google Custom Search - Name Your Engine
This is where you name your Google Custom Search engine.

Google will create a new search engine for you. Click on the get code button and copy the code provided on the next page.

Google Custom Search engine creation success page
Google Custom Search engine creation success page

Adding the New Search Option to Your WordPress Site

As you can see, the necessary code for our Google Custom Search is already generated. So now, we need to paste this code snippet into the proper WordPress template.

From your admin panel, go to Appearance > Editor and find the searchform.php file. This page populates the search form for your WordPress site. If there is not a searchform.php file already, you need to create one.

Open this file using the WordPress Editor and paste the code for Google Custom Search Engine you previously copied. Update the file in order to save all changes.

Now go to Appearance > Widgets menu from your admin dashboard. There should be a Search widget in the Available Widgets list. Drag this Search widget to the area where you want to display your search form. For example, you may drag the Search widget to the Main Sidebar. Now save the widget to update your site.

And that’s all there is to it! You have successfully created a Google Custom Search Engine for your WordPress site.

Styling Your Search Engine With Google

You might not like the default styling of your newly created search form. If this is the case, Google offers you the option to customize the look of your search form. Google Custom Search Engine website offers plenty of options to change the look of the search form.

If you go to the website and take a look at the menu on the left sidebar, you will notice some options to customize the search form. The Look and Feel menu will show you plenty of options to style your search form.

Style and design the 'look' of your Google Custom Search engine
Style and design the ‘look’ of your Google Custom Search engine

You can choose from a list of ready-made search themes. Under the Customize menu, you can select font, background color and border property. There are also options to choose Layout and Thumbnails. After styling your search form, just hit Save and the changes made will be visible on your WordPress site.

In the image below you’ll see how the Google Custom Search bar could look on your website. The final appearance will vary depending on the styling options you choose and your WordPress theme.

Add Google Custom Search On Your Site
This is how custom search could look on your site. It’s final look depends on your theme and the styling options you chose.

I have gone through the necessary steps of creating a Google Custom Search Engine for a WordPress website. Have you been able to follow me along? Don’t forget to share your experience with me.

Share this post:

Leave a Comment

Your email address will not be published. Required fields are marked *

WPLearningLab