Ready to get started?Download WordPress


Custom google search (1 post)

  1. pengume
    Posted 4 years ago #

    Hello, I am trying to create a custom google search engine, however I don't want to use the google search form I want to use the existing wordpress form, however I would like to pass it the variable that is being searched. How can I accomplish this what do I need to put into this code to have it work the way I want?

    google.load("search", "1");
        function OnLoad() {
          // Create a search control
          var searchControl = new google.search.SearchControl();
          // Add in a full set of searchers
          var localSearch = new google.search.LocalSearch();
          searchControl.addSearcher(new google.search.WebSearch());
          searchControl.addSearcher(new google.search.VideoSearch());
          searchControl.addSearcher(new google.search.BlogSearch());
          // Set the Local Search center point
          localSearch.setCenterPoint("New York, NY");
          // Tell the searcher to draw itself and tell it where to attach
          // Execute an inital search

    I think some wordpress search variable or key needs to be passed into searchControl.execute("Google"); where "Google" is.

    Thanks for any help .

Topic Closed

This topic has been closed to new replies.

About this Topic