What's WP
Our everything is about WordPress - best choice of WordPress users!
How to Embed WordPress Site with Google Search Box

How to Embed WordPress Site with Google Search Box

For any WordPress website, whether a popular one or a newly-launched one, a conspicuous search box is pretty essential. After all, readers need it to search for the specific information by entering a related query. This feature can improve the usability of your site to the largest extent, thus guarantee a good reading experience to your visitors effectively.

Since October 24, 2006, Google has released a powerful and useful tool named as Google Custom Search Engine, which allows webmasters to attach a search box to their sites with ease. In the following, we’d like to show you how to integrate the WordPress site with Google search box.

Create a Custom Search

In the very beginning, you need a Google account to sign in the homepage of Google Custom Search Engine. If you don’t have one, it is time to carry out a registration process. After entering the right page, click on the Create a Custom Search Engine button.

Google custom search home page

Then, you can be redirected to the creation page that requires you to fill out the name and URL of your site. In general, it applies for any of the following.

  • Individual pages: www.example.com/page.html
  • Entire site: www.mysite.com/*
  • Parts of site: www.example.com/docs/* or www.example.com/docs/
  • Entire domain: *.example.com

The new search engine will be automatically named according to the URL selected, and you can change it at any time you want.

While finishing those blank spaces, simply click the Create button.

google search box creation

If you have already used this tool to create Google custom search for another website, you will be directly linked to your previous creation like the image showed below. At this time, you need to click the New Search Engine option in the left bar to set up a new one.

create new search box

Next, describe your search engine by deciding the name, adding a short description, selecting the keywords, and choosing the language in the Edit Search Engine option.

describe google search box

Customize the Search Box

To make your search box eye-catching in your website, you need to customize the look and feel carefully. In the Edit Search Engine < Look and Feel section, you can decide the layout, theme, font, and color freely according to your preference. customize google search box

After deciding the appearance of the search box, simply hit the Save & Get Code button to be redirected the webpage containing the code needed to add the Goggle search box to WordPress.

See the coding example showed in below.

get code

Add Search Box to Website

At present, you have completely created a custom search engine, and it’s time to add it into your WordPress website. Find the searchform.php via Appearance -> Editor. Open the file and paste into the code copying from the custom search.

However, some themes don’t include the searchform.php File. In this case, you should create it by yourself. Create a text file and save it as searchform.php, then upload it to the theme directory by using FTP client.

After that, you need to drag and drop the search widget into the sidebar via Appearance -> Widgets.

search widget

Other Alternatives

In addition to the method introduced above, you can also make use of some powerful WordPress plugins like WP Google Search and WordPress Google Search. You only need to download and install one of these tools, and activate them in WordPress. Then, the Google Search widget can be created automatically.

WordPress Google Search

Author

Susan Rose is a freelance writer who has a deep knowledge about WordPress. She loves everything related to website building since the freshman year at Christopher Newport University, and loves to share her experience with people all over all the world. This girl is popular among our readers as she is outgoing and energetic. In the daily life, Susan loves detective novels as it can train her logical thinking and creativity.

Close

Want to Learn More About WordPress?

Get Our Free Themes, Plugins, Support, SEO Tips, and Other Tutorials!

Email *