Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Using Google Search in WordPress

  • This topic is empty.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #28886
    Scorix
    Member

    In my opinion, the standard search function in WordPress is insufficient, at least for non blog-like websites, and I’ve decided to implement Google’s search instead. The implementation was easy, but it doesn’t seem to work. I’ve followed the instructions from Google while creating the search, and the two snippets of code have been pasted in the sidebar (the code for the actual search bar) and in a WordPress page (the search results code).

    When I try to perform a search though, no matter what I search for I only get this:

    [attachment=0]search.png[/attachment]

    And yes, the words Lorem Ipsum exists whithin my site.

    So does anyone have any experience with this? Know anything that might help me solve this?

    Any help is greatly appreciated! :)

    #74919
    Chris Coyier
    Keymaster

    It may need more time to crawl your site? No idea, really. You might want to make 100% certain you have the domain name correct when you created the Google Custom Search.

    #74932
    Scorix
    Member

    How long does it usually take for Google to crawl my site then? Posted this shortly after implementing the search, so that’s probably the reason.

    Is there a way to request Google to crawl your site maybe?

    #74937
    jusitennis
    Member

    I have spent hours trying to get Google Search to work on my site. Argh! I have no problems getting google to search my site and produce the results on Google, but I can not get the results to show on a search results page that I have created. After inputting text to search for, the search results page is loaded but only with a header and a footer and no iFrame in the middle with the search results (snapshot attached). I have tried to troubleshoot but can’t find anything wrong….

    This is the code that was added to header.php:

    <form action="http://www.neighborhoodpromos.com/wp-content/themes/couponpress/search.php&quot; id="cse-search-box">
    <div>
    <input type="hidden" name="cx" value="002698160822890171754:v3umwe-ej3w" />
    <input type="hidden" name="cof" value="FORID:10" />
    <input type="hidden" name="ie" value="UTF-8" />
    <input type="text" name="q" size="31" />
    <input type="submit" name="sa" value="Search" />
    </div>
    </form>
    <script type="text/javascript" src="http://www.google.com/cse/brand?form=cse-search-box&lang=en"></script&gt;

    and this is is the code that was added to the results page:

    <div id="cse-search-results"></div>
    <script type="text/javascript">
    var googleSearchIframeName = "cse-search-results";
    var googleSearchFormName = "cse-search-box";
    var googleSearchFrameWidth = 600;
    var googleSearchDomain = "www.google.com";
    var googleSearchPath = "/cse";
    </script>
    <script type="text/javascript" src="http://www.google.com/afsonline/show_afs_search.js"></script&gt;

    Any help would be really appreciated!! Thank you!

    #74933
    Scorix
    Member

    The code that you add to the results page have to be added to a WordPress page, the only thing you need to put in it is the code provided by Google.

    Then you need to use the URL to that page, NOT the URL to the file on your server as you have done. So instead of using this:

    Code:

    you should use this:

    Code:

    or whatever the URL to that page is.

    Remember to go to Google and update the settings for the search, don’t just edit the code.

    Note: If you haven’t already, you should change the Permalink structure in WordPress (Dashboard > Settings > Permalinks) to whatever you want to use, as long as you’re not using the default. I at least, had trouble getting search to work when using the default structure. A popular choice is this one: /%category%/%postname%/ (Cut and paste into the custom one).

    Try these things out and let me know if it helps :)

    #74964
    jusitennis
    Member

    Ahhh – you gave me an idea. Thank you! I had tried creating the wordpress page a few days ago using a new template page I created called "search". But, initially it did not work. So instead of playing around with the page in wordpress, I cleared some code away from the php code from the template php file instead. Now it works. Thank you so much….you just saved my weekend! Unless, I start styling now :)

    #75021
    Scorix
    Member

    Happy to help :)

Viewing 7 posts - 1 through 7 (of 7 total)
  • The forum ‘Back End’ is closed to new topics and replies.