WordPress.org

Ready to get started?Download WordPress

Forums

Google Custom Search Plugin
Don't waste your time (10 posts)

  1. dsa
    Member
    Posted 2 years ago #

    The guy was to lazy to describe the installation process (there's no "iframe option" for example on the Google site) - why do you think he was not lazy writting the plugin?

    Lot of unpredictable behavior, alerts and it simple does not work.

    Let's try in 40'th line of code:

    self::$google_search_box = preg_replace('/size="31"/is', 'id="s" value="'.$q.'" ', self::$google_search_box);

    It is needless to say there's no any magic "31" digits in the google_search_box, so all the code is broken.

  2. flammable
    Member
    Posted 2 years ago #

    I successfully implemented this last winter. Since then, Google's deprecated the iframe option. I discovered this when trying to add it to a new site I'm building - you're not even given the iframe option anymore.

    I'll need to find something else for both sites. This worked quite well up until now, though.

  3. flammable
    Member
    Posted 2 years ago #

    Okay, I got this to work again. I'll write the author shortly.

    In the meantime, if you'd like to use this, do as the author says here:

    http://aleembawany.com/projects/wordpress/google-custom-search-plugin/

    As there's no longer an iframe option, though, choose "results only" for the layout. I chose "minimalist" for the style, but it probably doesn't matter. Click "save and get code".

    Once you've enabled the plugin in your WordPress installation, paste that code into the second box on the config page (the search results one).

    So, that takes care of how to display the search results. But you'll need a search box too. For that, I found this page on Google's site:

    http://www.google.com/support/customsearch/bin/answer.py?answer=1728572

    I used that code, but had to get rid of the last line - it was showing the "Google custom search" image below the search box, not inside. As the page says, find and fill in your search engine ID. Paste the code into the first box of the WordPress plugin config page, and you're done! Save and go to your site to test.

  4. vwz1
    Member
    Posted 2 years ago #

    Hi Flammable thanks for finding that solution and it works for me---until it comes time to add teh actual search box to the site. How did you do this? When I added the standard WordPress search widget to the sidebar and tested it, it did not pick up the GCS but isntead took me to a page with the GCS box which seemed a bit redundant.

  5. flammable
    Member
    Posted 2 years ago #

    Looks like I'm not using the widgets at all. Instead, I've got a child theme (based off of Twenty Ten), and this code is in header.php:

    <!-- Search Box Begin-->
        <div class="header-search">
          <?php get_search_form(); ?>    </div>
    <!-- Search Box End -->

    I've got this in my style.css too:

    /* Searchbox Style */
    .header-search {
     height: 30px;
     clear: right;
     float: right;
     margin: 6px 0 18px 0;
     width: 220px;
    }
    .search-text {
     float: left;
     display: block;
     height:20px;
     width:160px;
    }

    Hope this helps! I wrote the author last November but never heard anything.

  6. vwz1
    Member
    Posted 2 years ago #

    Thanks I will play around with that and see if I can get it to work for me.

  7. foshdafosh
    Member
    Posted 2 years ago #

    Hello there,

    I've tried your solution flammable, but I've got the same issue as you vwz1.
    I'm new to this, so I'm just using a tweaked version of the twentyeleven theme.

    I don't you managed to sort out the problem did you?

    Ta muchly,
    Pete

  8. flammable
    Member
    Posted 2 years ago #

    foshdafosh, did you use the code in both of my posts? I just checked, and the search box is still functional on my sites.

    I'm not sure if it matters, but I'm still using the Twenty Ten theme, not Twenty Eleven.

  9. vwz1
    Member
    Posted 2 years ago #

    Hi Pete

    I never sorted the problem. I am looking for anotehr way of adding GCS to the site.

  10. flammable
    Member
    Posted 2 years ago #

    Hey guys.

    I need to implement this on another site this week - I'll write up a proper how-to.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic