How can I add the Google search bar to my WordPress blog?

Lewis August 11, 2010

I’m trying to put a Google Search Bar (with ads) into the main navigation bar on my website, but I don’t know how to do it.

I put the code into the index.php but it just puts the search bar at the top left of the screen, not where I want to put it. Can someone help me please?

My site is and I want the bar to go in the bar that has “Home” and “About” at the far left.


  1. Nic
    July 16, 2011 at 5:20 pm

    if you are looking for the search box or the youtube search box or yahoo or bing i have create them. they work and when you search them they take you to there website. the google search box is :

    Youtube is:

    yahoo is:
    hope this is what you are looking for. To behonest i didnt eeven  really read the question properly but i wanted to share what i have done. they are pretty easy to make, only took me 2 minutes to figure out and im only 15

  2. Lewis
    August 19, 2010 at 1:08 pm

    im really confused now =S do you have msn or anything so i can chat to you through it?

    • John McClain
      August 19, 2010 at 1:14 pm

      Sure! I have GTalk or email me: jmcclain [at]

      • Lewis
        August 19, 2010 at 1:37 pm

        added you, on GTalk. I'm using meebo though as i dont accutally have it

  3. Lewis
    August 18, 2010 at 4:40 pm

    Sorry i posted a few days ago but it didnt work, I'm pritty sure that the address is the one that i put in but il try again.
    The post structure i mean like /catagory/post or whatever i tried it once but it didnt work.

    • John McClain
      August 18, 2010 at 7:41 pm

      The reason I think it's the incorrect address is because when you search for something, it gives you a new URL ending with: "Search&"

      It should be: "Search&siteurl="

      • Lewis
        August 19, 2010 at 12:58 pm

        where do i put that? In the google search bar setup?

        • John McClain
          August 19, 2010 at 1:05 pm

          Yes, put just "" as the search results page URL and I think that should fix it.

  4. Lewis
    August 13, 2010 at 10:05 pm

    Okay i did what you said but now the search does nothing, I think it is something tondo with the link for the results page, I just copied the permalink that it said the page URL was,
    Is that right, if you know how can you help me structure the posts like MUO's? I think it would make this easier and make it more search engine friendly


    • John McClain
      August 14, 2010 at 2:19 am

      Yeah, it looks like that's not the right URL for the search results page. It should be:

      Try that to see if it works. Also, what do you mean by structure the posts like MUO's? You may want to ask that as a separate question from this one.

  5. Lewis
    August 13, 2010 at 9:31 pm

    Thanks mate I understand now :)

    Will test it out now, il post If I get it to work or not

    August 13, 2010 at 6:49 pm

    if you like wysiwyg, you could use a code snippet...

  7. Lewis
    August 12, 2010 at 12:54 pm

    How do I make a new page in wordpress? I made a page in notepad called it pageresults.php and pasted the code into it, and I think I choose to open results in my page anyway

    • John McClain
      August 12, 2010 at 7:57 pm

      Sorry, I wasn't clear enough. What I meant by new page was just make another "About" page and call it "Search," for example. So, just go to "Pages" on the left-hand side and hit "Add new."Then, paste the code into the actual body content of this page under the HTML tab. Let me know if you need any help.

  8. Lewis
    August 12, 2010 at 9:45 am

    Oh , do you know hiw I could put my theme on the page?

    • John McClain
      August 12, 2010 at 10:29 am

      Go to "Manage Ads" and click on "Edit settings" for AdSense for Search.Under "Search Results Style", hit the option to open results within your site. You then have to enter in the URL of where the search results will be displayed. Just make a new page in WordPress and type in its URL.Now, just paste the Search Results Code into the new page's HTML in WordPress. From there, you can resize the width of the results frame to make it fit with your theme. I recommend that you make the page full width if you can.

  9. Lewis
    August 11, 2010 at 11:11 pm

    I have it in now but not exactly where I want it. I don't know I there's a way to overylay it there or something but I suppose il leave it where it is.

    Does the computer have to be one connected to another network or just another pc on your network?
    Could you test it for me please?

    • John McClain
      August 11, 2010 at 11:32 pm

      I think you're allowed to test it yourself (just don't click on any of the ads of course). I've set up and tested AdSense for search on my website before and my account was fine.

      It's working, but the search results are displayed on a plain white page.

  10. Steve Campbell
    August 11, 2010 at 10:49 pm

    I've seen tutorials on how to do this on youtube. Just search for 'navigation bar search' and you should find what you're looking for. There are also some pretty good tutorials on Fourblogger.

    To test the search bar, try navigating to your website from a different browser/computer, preferably one from which you are not currently logged in to your wordpress account. Then, run a search to test it.

  11. Lewis
    August 11, 2010 at 6:44 pm

    I have got it in now but not in the home and about bar.

    How can I test that the search is working? Because apparently if I do a search myself my account will get blocked.

Ads by Google