multiple google custom search bars on one site

i would like to have multiple google custom search bars on one site, is it possible?

  • Paul

    Hi Predrag

    I am talking about the google search plugin

    With this plugin you can customise the result of the search to produce a certain result
    Eg. I could customise it with the word tutorial - so any time some one searches they get results related to tutorials.

    What I was wondering was if I could some how have one search bar customised to tutorials and the second search bar customised to cars.

    This question is spercific to the google search plugin

    Thanks a lot for your time.
    Paul ~:smiley:

  • Predrag Dubajic

    Hey @Paul,

    Thanks for clearing this up, I thought I was loosing it, think I get it now :slight_smile:

    So here is something that you can try, but note that this is not fully tested and I might be way off, it won't break anything on your site tho, I tested that.

    First thing is to create two custom searches for your site and you will have two codes that are used in the plugin Embed Code field.
    Lets say first code is something like this 003250020577837178843:6rbg_0n_wts, go ahead and place that code in plugins Embed Code field and save the settings.

    Now go to your widgets and add Custom Google Search widget to your sidebar/footer and save the changes.
    Open your sites front end and go right click on any empty space and click on View Page Source.
    In the tab that opens search for your code 003250020577837178843:6rbg_0n_wts and you should find a part of code that looks like this:

    <script src="http://www.google.com/jsapi" type="text/javascript"></script>
    
                <div id="cgs-search-form-30" style="width: 100%;">Loading</div>
                <script type="text/javascript">
                    google.load( "search", "1", {language : "en_US",} );
                    google.setOnLoadCallback( function() {
                    var customSearchControl = new google.search.CustomSearchControl( "003250020577837178843:6rbg_0n_wts" );
    
                    var options = new google.search.DrawOptions();
                    options.setSearchFormRoot("cgs-search-form-30");
                    options.setAutoComplete(true);
    
                    customSearchControl.setResultSetSize( google.search.Search.FILTERED_CSE_RESULTSET );
    
                    customSearchControl.draw( "cgs_popup", options );
                             customSearchControl.setSearchCompleteCallback( this, CallBackDisplayPopup );
    
                    }, true );
    
                    //callback function
                    function CallBackDisplayPopup(result) {
                    	jQuery( "#cgs_popup" ).dialog( "open" );
                    }
    
    				//code for display popup with results
    	            jQuery( document ).ready( function() {
    
    	                // popup
    	                jQuery( "#cgs_popup" ).dialog({
    	                    autoOpen: false,
    	                    width: 600,
    	                    height: 500,
    	                    modal: true
    	                });
    
    	            });
                </script>

    Copy that part of code (don't use the one I posted, it's just an example) and paste it in text editor like SublimeText, Notepad++, NetBeans...
    Now search again for code 003250020577837178843:6rbg_0n_wts and replace it with your other custom search code.

    Copy the entire code again, go to widgets, add new Text widget and paste this code in widget content.

    Please let me know how it goes, I'm curious about results :slight_smile:

    Best regards,
    Predrag

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.