Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm using the Google Custom Search plugin by edwinkwan (the first that appears in the wordpress plugin repository).

I added the search box:

<?php display_search_box(DISPLAY_RESULTS_CUSTOM); ?> in the header.

and the results:

<?php display_gsc_results(); ?>

in this page:

http://alexchen.info/taiwantalk/search-results (Which is a tempalte called search-results.php)

Now, I can only see the results if I perform a search in that page (with the search box in the header). If I just search for something, for example, in the front page, absolutely nothing happens. For instance, If I perform search from: alexchen.info/taiwantalk Nothing happens.

I couldn't find anything like: "the search results page" in my Google Custom Search Panel.

Apparently the Custom Google Search is working but the search is not being redirected to search-results.php when I perform a search in any other page.

Any suggestions to fix this?

EDIT: I also tried this plugin: wordpress.org/extend/plugins/google-custom-search-for-wordpress/ but it seem to be based on the code of Google Custom Search of 2010. It requires you to get two pieces of code (the search box and the search results). But Google Custom Search's Panel only provides one.

Like this:

<div id="cse" style="width: 100%;">Loading</div>
<script src="http://www.google.com/jsapi" type="text/javascript"></script>
<script type="text/javascript"> 
  google.load('search', '1', {language : 'en'});
  google.setOnLoadCallback(function() {
    var customSearchControl = new google.search.CustomSearchControl('018208799159621054256:jivnd4spmig');
    customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET);
    customSearchControl.draw('cse');
  }, true);
</script>
<link rel="stylesheet" href="http://www.google.com/cse/style/look/default.css" type="text/css" />
share|improve this question
    
"Am I doing something wrong?": Yes. - You should make your Q a little more clear. I guess yes/no is not what you want to hear. –  kaiser Aug 19 '11 at 17:14
2  
@kaiser Sorry, is it clear enough now? –  janoChen Aug 19 '11 at 17:20
add comment

1 Answer

You could try the Google CSE plugin.

I've tried both the plugins you mentioned above, but I couldn't get them to work in the way I wanted, so I settled with the Google CSE plugin, and I'm rather happy with how it works.

It actually serves the results from your Google Custom Search Engine via the WordPress search listing, which means there is no need to customise your theme or search box. Because of this special integration, you also need a Google API Key (as well as the CX from your Custom Search Engine).

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.