As we know if somebody visits a site to find, what he exactly looking for, he first looks for the search box in the site. That’s why it is very important to insert a search box in a proper place so that a visitor can find it quickly. One of the eye catching places in any page is the top menu area, if you insert a search box in WordPress menu area then it can be accessible very quickly for every visitor.
WordPress provides a default search widget which can be added to footer or any widget ready area. This default search widget having limited capabilities and a few customization options like limited places to add the search box. In this article how to add search box in WordPress menu is a step by step guide to add a search box in WordPress menu and also demonstrating how to add Google Search in WordPress .
Some Reasons To Add Search In Menu.
WordPress default search widget can be added to limited places like sidebar or in footer area. Suppose if your theme doesn’t support a sidebar or if search box in a mobile site is not appearing in proper place, then it a good practice to add search icon in your site where a visitor can easily find it. Adding a search box in WordPress menu bar section is very easier for a visitor to quickly find it.
How To Add Search Box In WordPress Menu Manually?
Every WordPress theme provides a top menu section, which appears at the top of the site. See the image below.
Step 1: Open header.php in Theme Editor.
Dashboard >> Appearance >> Theme Editor.
Step 2: Open header.php In Theme Editor.
All the theme files are appear in right side file list box in theme editor. Select header.php to edit. See the Image.
If you want to know more about how to edit WordPress theme files follow the link.
Step 3: Paste The Code.
<?php get_search_form(); ?>
Paste the code given above at the bottom of header.php file. It will look like. (See the image)
Step 4: Click On Update File.
After pasting the code, click on update file.
Now it’s time to test the effect of the code. You will get a search box in top menu area.
How To Add Google Search in WordPress Using Plugin?
To add Google Search in WordPress, we need to search a plugin in WordPress Plugin Store. Here we are using WP Google Search Plugin to add Google search in WordPress. Steps are as follows.
Step 1: Go To WordPress Plugin Store.
Dashboard >> Plugins >>Add New.
Step 1.2 Search the WP Google Search plugin.
We are adding Plugin search result Page.See the image.
Step 2: Install The Plugin.
Click on Install Now button, the plugin will get installed in WordPress.
Step 3: Activate The Plugin.
Go to Dashboard >>Plugins, search WP Google Search Plugin and activate it.
Step 4: Go For Plugin Setting.
This plugin can be found under Dashboard >> Settings option. See the image.
Step 5: Finding General Settings.
Click on WP Google Search option under the Settings. It will open plugin’s General Setting page.
There are many options given in General setting page. Now we have to enter Google search engine ID. In order to find Google Search Engine ID, we have to follow following steps and after getting the ID, just paste it to the Google Search Engine Id box.
Step 5.1: Click On The Link.
The first setting option in General Setting is Google Search Engine ID. Click on the link https://www.google.com/cse/ given just beneath it. You will be headed to Programmable Search page. It also needs your google login credentials, if you are already logged in to Google then you will be headed to the page otherwise you will have to log in first. The Programmable Search page image is given below.
In the option Sites to search, here we are going to add example site address Demo1.wphow.xyz. Even though we have other options like any individual page or a domain address. After Entering the address click on CREATE button.
Step 5.2 Enter Site Address.
After clicking on CREATE button you will be headed to a new page. This page also having many options.
Step 5.3 Click On Control Panel Button.
You will be now headed to another new page. This page having 4 tabs. Under Basics tab, find Search engine ID and copy it. We have to paste this ID in Google Search Engine ID option of WP Google Search Plugin’s General Settings Screen .
Step 5.4 Getting ID.
Step 5.4 Paste The ID.
Step 5.4 Click On Save Changes Button.
After entering the ID scroll down the screen and press Save Changes.
Now it time to place Google Search box in our site. Google Search box appears as a Widget, so we have to insert this Widget in any Widget ready section of the theme. Steps are as follows.
Step 6: Click On Widgets Option.
You can find the Widgets option as Dashboard >> Appearance >> Widgets.
Step 6.1 Search The Widget.
As you scroll down the Widget screen, you will get WP Google Search Widget.
Step 6.2 Set The Widget.
Now we have to set the Widget in any Widget ready section of the theme. Twenty Twelve example theme having Main Sidebar, Front Page Widget Area and Second footer Page Widget Area. Other themes may have different options, you can customize it according to you theme. We are placing the Widget in Main Sidebar Widget section. Just click and drag the Widget and drop it to Main Sidebar section.
There is also a Title option where you can enter title for the search box.
Now it’s time to see the effect. See the image.
That’s how you can insert a Google Search in WordPress site.
Connect With JustHyre
Hire WordPress Engineers for custom jobs like Website Customization, SEO Optimization, Clearing a Hacked Website, Installation & Configuration & more.Connnect with JustHyre