Jump to content
Sign in to follow this  
llwvc

Add Google Custom Search

Recommended Posts

llwvc

How do I replace WordPress default search engine with Google Custom Search? - Do I choose the "Search Element" option or the "iframe" option? - Which part of which file do I edit? I use PlatformPro. P.S. Pagelines should put this in the option.

Share this post


Link to post
Share on other sites
llwvc

Thanks for replying. I tried it but the WordPress default search redirects all search to the Google search bar (where you can search), not the search result directly (if you know what I mean).

Share this post


Link to post
Share on other sites
bryan-hadaway

You might need to go to the settings; Settings > Google Search and adjust. Let's get a link with the plugin active so I can test, you may not be using the right plugin as well. Thanks, Bryan

Share this post


Link to post
Share on other sites
llwvc

If you can tell me how to change the searchform.php, I would really appreciate. I know I need to replace some code in the searchform.php file with Google Custom Search's Search box code. But I don't know which parts to replace. Please help. Thank you very much for replying.

Share this post


Link to post
Share on other sites
llwvc

<?php /* SEARCH FORM This file is the template for the theme searchform. This theme copyright © 2008-2010 PageLines */ ?> <form method="get" class="searchform" action="<?php echo home_url(); ?>/"> <fieldset> <input type="text" value="<?php _e('Search','pagelines');?>" name="s" class="searchfield" onfocus="if (this.value == '<?php _e('Search','pagelines');?>') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php _e('Search','pagelines');?>';}" /> <input type="image" class="submit btn" name="submit" src="<?php echo THEME_IMAGES;?>/search-btn.png" alt="Go" /> </fieldset> </form> <script type="text/javascript" src="http://www.google.com/jsapi"></script> <script type="text/javascript"> google.load('search', '1'); google.setOnLoadCallback(function() { google.search.CustomSearchControl.attachAutoCompletion( '012547662658986420133:4ogmfefoivu', document.getElementById('q'), 'cse-search-box'); }); </script> <form action="http://i3520.com/search" id="cse-search-box"> <div> <input type="hidden" name="cx" value="012547662658986420133:4ogmfefoivu" /> <input type="hidden" name="cof" value="FORID:9" /> <input type="hidden" name="ie" value="UTF-8" /> <input type="text" name="q" id="q" autocomplete="off" 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〈=en"></script> This is the whole thing. How should I change it? Thanks

Share this post


Link to post
Share on other sites
bryan-hadaway

Again, this is why I recommend a plugin, so there's no need to actually get into the code. If you still want to go this route I'll at least need your link to test. Thanks, Bryan

Share this post


Link to post
Share on other sites
llwvc

the site i am talking about is www.i3520.com if you search anything, it redirects you to a search bar. please let me know how to fix it. thanks

Share this post


Link to post
Share on other sites
cmunns

Leo I'm checking the site right now and I see that the google custom search displays the results right there in the sidebar...is that what you wanted?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×