More from Google Plugin
« Back to WordPressNow you can easily add search results from Google within your WordPress search results page.
The More from Google plugin adds the required fields to your
search form and outputs the required XHTML and Javascript to display
Google's results within your WordPress search results page. This can be
used:
- simply to provide your readers with related results from other sites.
- with google site search to provide the readers with supplemental results so they can search WordPress pages and non-WordPress pages on your site.
- encourage readers to stay at your site longer.
- increase your revenue through Google's AdSense for Search program.
The More from Google plugin, also allows you to specify a search term for each post. This search term is used to create a link at the bottom
of your post linking to search results for that term. This encourages
your readers to Google for related articles, without leaving your site.
Download

This software is licensed under the CC-GNU GPL.
How it Works
Google provides an option to have their results embedded within your page. To achieve this, Google can provide you with code for a custom search form and code for displaying the results.
The More From Google plugin creates a merged search form, combining Google's search form, with the default WordPress search form. When this merged search form is submitted, it tells both WordPress and Google to perform the search. Because Google's portion of the form
is designed to be destination independent (it doesn't care what what page your results are shown on) there form is still directed to the WordPress search results page.
Your search results page will display the WordPress search results as usual and with slight modification using the display code from Google, it will also show the search results from Google.
The More from Google link at the bottom of each post call a Javascript function that populates the search form and then submits it. Because the embedded results from Google will only be displayed if Javascript is enabled in your readers browser, the More from Google link is only displayed if Javascript is enabled.
Demonstration
Simple go to the end of this page and click on the "Google for AdSense for Search »" link.
Installation
Installing With Themes That Support More From Google
- copy the `more-from-google` directory to your `wp-contents/plugins` directory.
- Activate the More from Google plugin in your plugins administration page.
- When editing your posts, add a search term in the 'Google Search Term' field.
Installing With Themes That Don't Support More From Google
- In the theme you are using, make sure the id of the search form is `searchform` and add the following code within the search form:
for instance, in the default theme, you would edit `searchform.php` and changeif( function_exists( 'mfg_search_inputs' ) ) { mfg_search_inputs(); }to<form method="get" id="searchform" action="<?php bloginfo('home'); ?>/"> <div><input type="text" value="<?php the_search_query(); ?>" name="s" id="s" /> <input type="submit" id="searchsubmit" value="Search" /> </div> </form><form method="get" id="searchform" action="<?php bloginfo('home'); ?>/"> <?php if( function_exists( 'mfg_search_inputs' ) ) { mfg_search_inputs(); }?> <div><input type="text" value="<?php the_search_query(); ?>" name="s" id="s" /> <input type="submit" id="searchsubmit" value="Search" /> </div> </form> - In the theme you are using, add the following code to the end of the search page:
for instance, in the default theme, you would editif( function_exists('mfg_show_results') ) { mfg_show_results(); }search.phpand changeto<?php endif; ?> </div> <?php get_sidebar(); ?> <?php get_footer(); ?>
<?php endif; ?> <?php if( function_exists( 'mfg_show_results' ) ) { mfg_show_results(); }?> </div> <?php get_sidebar(); ?> <?php get_footer(); ?> - In the theme you are using, edit the search results page and the following condition to the
have_postsif statement:(!function_exists('mfg_show_wordpress_search_results') || mfg_show_wordpress_search_results())
for instance, in the default theme, you would editsearch.phpand changeto<?php if (have_posts()) : ?>
<?php if (have_posts() && (!function_exists('mfg_show_wordpress_search_results') || mfg_show_wordpress_search_results())) : ?> - Perform the same steps in "Installing With Themes That Support More From Google"
Frequently Asked Questions
Got any questions?
Release Notes
- 0.0.2
- Added support for old WordPress 2.0 installations
- 0.0.1
- Better handing of middle clicks.
- Added BeNice support.
- Fixed Readme.txt
- 0.0.0
- Initial Release
« Back to WordPress
37 comments.











Just installed your plugin and I’m getting no Google results? The plugin is active and I added the code to the searchform.php and search.php. Hmmmmm?
Oh yeah. Using WP 2.2.
I just had a look at your site, and none of the MFG generated code appears in your search form. Are you sure the form on the main page is coming from searchform.php?
Here is my searchform.php:
/”>
I had a look at the files you sent me and the look correct. Can you email me your the index.php from your theme?
Hey. Is there any way for this plugin to work on WP 2.0? Thanks.
There is no specific reason why the More from Google plugin shouldn’t work with WP 2.0. I just haven’t tested it. Feel free to give it a go and let know if it does or doesn’t work.
Hey. Ok, I tried it, but I am getting an error when I go to write/edit post in wp-admin. The error is…
Fatal error: Call to undefined function attribute_escape() in /home/…/wp-content/plugins/more-from-google/morefromgoogle.php on line 176
Any ideas tom? I’m clued out.
Looks like
attribute_escapewas introduced in WP 2.1 or 2.2. Add the following function tomorefromgoogle.php// Escaping for HTML attributes function attribute_escape($text) { $safe_text = wp_specialchars($text, true); return apply_filters('attribute_escape', $safe_text, $text); }Ah, that did the trick, thanks! Also, this plugin seems to have a conflict with the firestats plugin—After trying a search, the page was filled with mysql errors but turning off that plugin and there was no problem. Though, no search results seemed to appear. Do you need an adsense account for this to work?
Thanks again Tom.
A.
I’m downloading firestats to find out what the problem is. I had a look at your site and it appears that either MFG is not enabled or you haven’t modified the theme to support MFG. You don’t need a AdSense account for it to work.
I just installed firestats locally on my machine and didn’t notice any errors. It might just be an issue with wp 2.0.
That sucks about the firestats thing (it’s pretty touchy) but on the bright side I got it working! The problem was the snippet for the search results wasn’t actually on the page.
You might want to do a quick update to your directions
as I think Step 2 should probably read:
Right now it says:
Cheers.
Well spotted. I’ve updated the directions. Thanks.
The 0.0.2 download link is broken.
Thanks. It’s fixed now.
It ugly as you embbed your Adsense for search in it. Anyone who donwload this plugin, plugin author will get paid when anyone did search on your site. Check the code line 332.
Have a look at the options page for More from Google. It provides an option to set your own AdSense for search code. Hence the “Revenue” tag.
Tom, I just want to thank you for this awesome plugin. It works fantastic. For your info: I’m using WP 2.2.1.
Only one question is left. (Nothing to worry about. :mrgreen:) I wonder why there is such a big space at the end of the search results. Is there a reason for it? I double checked with a search on your page. The same. So … if you have time one day I would be happy if you could satisfy my curiosity.
Thanks again and have a great weekend.
It’s just the way Google’s code works. If I get the chance I might look into some JS which would shrink the i frame after it’s been loaded.
Thank you, Tom. I just found out by coincidence that the space depends on the options you set up directly for Google search. Usually I’m used to 100 results/page. Since I installed the plugin that must have been overwritten with the standard of 10 somehow. However, I wanted to have my 100 back. After that had been done I realized that there isn’t a space anymore. But neither a pagebar.
I have tested a few options and with 20 results per page it’s perfect. Hurrahhhh …
Greetz from Germany. Enni
I’ve installed your plugin on WP 2.2.1 and made the above php changes to my theme (Copyblogger).
The More from Google link does not function. Do you have any suggestions?
I know that Copyblogger has its own search. Is this overriding your plugin somehow?
(The provided link is the only post that I am testing Google search terms on currently.)
Hi, I’ve just had a look and your search form has the id ’search_form’, whereas More from Google expects it to be ’searchform’. You can either edit morefromgoogle.js (replacing ’searchform’ with ’search_form’ or edit the search form itself (which appears to be a widget, so wp-include/widgets.php).
Tom, thank you for checking my site. I made the changes that you suggested, but to no avail. Copyblogger’s search functions is still interfering.
I get a “parse error: syntax error” message, when I click on the More From Google link. It references a specific line of Boolean logic in the theme’s search.php.
At this point, I’ll check in with Chris Pearson (www.pearsonified.com) who created the theme to see if he has any work-arounds. I’ll let you know if there are any breakthroughs. Thanks again for your time.
hi there,
i need some help please…
i have done all steps but i think i made a stubit thing i change the Google Search Input Fields:
can anybody send me the code for this field
Hi had a quick look at your site and the only search form I could find points to google, not to your own site, nor does it have an id of “searchform”. I’m I looking at the right form?
i had to disable it… now its on
please take alook
thanks
The form is still pointing to http://www.google.gr/custom and doesn’t have an id of “searchform”
Hello. I’ve installed your pluging, and modified all the above mentioned tags but when i use my theme search box it only shows results from my blog, no results from Google.
Please have a look if you can and tell me whats the problem? Thank you very much
Hi there, just wondering… wouldn’t using this plugin risk your Adsense income because it’s not showing the Google Search Form AND (probably more importantly) you are auto-populating the search term (which from memory, is a BIG no-no!)
doesnt work at all !
I have been trying to make your plug in work with my site, and I have not been able to fix it so the search results have the Google search results in it. The link on the page works, sending me to the search results page. However, the results page only shows the site’s results, nothing from Google.
The URL is: blogs.malwarelabs.ca
Thanks in advance.
Hi, Tom!
Thanks a lot, for such a useful plugin.
As I don’t know nothing about php, could you try to explain, why it’s not working in my case.
the message i’m getting:
Parse error: syntax error, unexpected T_BOOLEAN_AND in /mnt/web3/11/65/51711565/htdocs/moi-augsburg/Sub-Domains/blog/wp-content/themes/coffeebreak-10/search.php on line 6
Line 6 in my search.php is:
&& (!function_exists(’mfg_show_wordpress_search_results’)
Is this information sufficient for you to say where is the problem?
I also cannot get this to work. However, I notice that there have been no replies from the developer to any of the comments since September 2007. Has development of this plugin ceased?
Is it incompatible with Wordpress 2.3.2 and up?
If you’re still around, Tom, I’ll send you my code and page link to take a look, but I followed your instructions meticulously.
If you’re out there, let us know.
Thanks
I am curious as to why you don’t use this plugin on your site?
Oh wait I see you do, but not utilizing the more from google link. This function only returns a # link and hasn’t worked for me yet through the search function.
Tom
I’m using your plugin More from Google on WP 2.5
Works fine in Firefox, not at all in Opera or IE 7 (no image on submit button in IE either!).
Any ideas?