Google News plugin
Displays N first news items from a selectable Google News RSS feed, inline or as a widget.
Google aggregates news from over 4500 news sources, updated continously. The results can be retrieved as a number of RSS feeds, where you can create your own specific feed by specifying one of more than 40 regions/languages, and an optional topic ranging from Domestic to Most Popular to Entertainment. Currently there are nine topics, including, of course, All. In addition to this, any feed can be filtered through a search query so that only news items matching your query will be shown. Note that not all combinations of region/language and topic has been enabled by Google but it should degrade gracefully.
This plugin works both as a widget, as inline content replacement and can be used in themes. It can be used as both simultaneously, but there can be only one instance of the widget. Multiple feeds can be configured and used accordingly.
NOTE! Always upgrade to the latest version if you experience problems, most things are fixed already.
The latest version is 2.2.
If you’ve configured feeds that use character sets like cyrillic, arabic and you’re getting errors from WP when trying to view the feeds then your WP MySQL database tables may be created with the wrong character set. Let me know and I’ll give you some pointers.
If you have a question or other comment, use the form below. Thank you!
Known bugs:
- There is a bug in the WordPress RSS engine, that sometimes show up when people use this widget. If you get something resembling “unknown function debug() in line 504 of wp-includes/rss.php” then that’s one of them. WP is aware of the problem, and apparently a fixed rss.php might be showing up in the next release. As a quick-fix edit wp-includes/rss.php and change line 503 from if ( MAGPIE_DEBUG ) { to if ( MAGPIE_DEBUG > 1 ) {
- When the widget fails with a php error like the one above, the template goes out of whack. I’ve made sure none of those are my fault in the next minor upgrade due out soon. I’m looking at better workarounds for the bug above first, so release might be a short while yet. Don’t want to spam you all with multiple releases like some widget writers…
- If you use the plugin in a template, it may fail. Leave me a comment and I’ll provide you with a fix. New version coming out soon, but I wanted to get a few more fixes in to avoid spamming the release system (like some plugin authors do…).
Example of inline content replacement.
Default feed <–google-news–>, alternating randomly between two feeds:
Google News : U.S. : All- Mukasey Collapses During Address in Washington; Hospitalized Overnight - Washington Post
- Obama's Clinton-era picks tend to fit the Bill - Chicago Tribune
- Thousands protest in Iraq against US troops pact - Reuters
- Greater APEC role urged in crises - United Press International
- Crisis Group Claims Frustration from Authorities in Puntland, Somalia - Voice of America
A different feed <–google-news#non-default–>:
Google News : العالم العربي (Arabic) : All- مصر لا تستبعد أي خيار لمواجهة القرصنة في خليج عدن.. بعد تأثر مصالحها الحيوية - الشرق الاوسط
- مثقفون شيعة يدعون الى تصحيح مسار الطائفة في الوطن العربي - الغد الأردني
- بان "أخذ علما" باتهام قادة التمرد في دارفور بجرائم حرب - الجزيرة
- فتاة أميركية تعيش بلا قلب 118 يوما - الشرق الاوسط
- تدابير أمنية وقائية في صيدا تواكب محاولات إقناع زعيم «فتح الإسلام» الجديد بتسليم نفسه - الشرق الاوسط
Shortcode test non-default [ google-news name="non-default" ]:
Google News : U.S. : All- Mukasey Collapses During Address in Washington; Hospitalized Overnight - Washington Post
- Obama's Clinton-era picks tend to fit the Bill - Chicago Tribune
- Thousands protest in Iraq against US troops pact - Reuters
- Greater APEC role urged in crises - United Press International
- Crisis Group Claims Frustration from Authorities in Puntland, Somalia - Voice of America
Shortcode test default [ google-news ]:
Google News : U.S. : All- Mukasey Collapses During Address in Washington; Hospitalized Overnight - Washington Post
- Obama's Clinton-era picks tend to fit the Bill - Chicago Tribune
- Thousands protest in Iraq against US troops pact - Reuters
- Greater APEC role urged in crises - United Press International
- Crisis Group Claims Frustration from Authorities in Puntland, Somalia - Voice of America
Shortcodes are only available in WordPress 2.5 and up.












October 5th, 2008 at 20:18
Thanks for coding such a great plugin. I am trying to have it working on my blog with no success so far. I am using WP version 2.6.2. It works fine as a widget. But when I try to do it as part of the theme using
I get the error “No default feed available”. Please suggest.
October 2nd, 2008 at 21:52
Hi Michael
The links you see are inside the Google news content, which I’m technically not allowed to manipulate according to Google TOS. But I’ll look into adding a target=”_blank” to the links to make them use another window though, that can’t be too much against the rules.
As for the complex query, it’s kinda limited in this release. If you just type in a list of words, that works as AND and will match articles that have all the words in them. For boolean or, you have to use the word “OR” as the first word in your word list. So “OR this that” (always without the quotes) means articles that have the word this OR the word that in them. I’m afraid that’s it for complexity at this point.
OK
September 28th, 2008 at 17:37
I’m having a few problems.
1) When you use the ’short’ version, sometimes there is an extra link that says something like ‘98 additional articles.’ This link opens in the same window, leading the reader away from the website. How can I get it to open in a new window? (I can hack if necessary.)
2) When you use the ‘long’ version, ALL the links lead away from the website. Again, I would like to get them to open in a new window.
3) How can I use a complex query, i.e. something like “Religion and Politics” or “Religion or Politics”, that uses boolean logic?
Thanks
September 18th, 2008 at 09:33
Hi,
I have the same problem as braddock!
The Plugin shows:
Google News : Österreich : Top News
Google News unavailable
but my tables are utf-8?
September 10th, 2008 at 15:03
Hi,
i want to show the news about Andalucia, a region in Spain, on my site. So how do i set the optional query filter ? I use the code to put it in the PHP files now: