How to add a beautiful Google Custom Search to your WordPress navigation bar

If you have too much unused space on your WordPress navigation bar (primary menu), you can fill it with Google Searchbar.

Login to your AdSense account and get a Google Search bar code.

In your WordPress Admin page, select Appearance->Edit

Select Header.php on the right.

Scroll down to the end of the file until you see a closing </nav> tag

Above it, add the following code:

<div class="newsearchform">
[put the Google code here]

</div>

Now open styles.css and add the following

.newsearchform
{
margin:10px 10px 10px 0px;
float: right;
}

That’s it. Now you have the Google Custom Search in your navigation bar.

Leave a Comment