Kolbu

Computers, Gadgets and Beyond!
Subscribe

Google News plugin

April 07, 2008 By: webmaster Category: WordPress Plugins

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.

Download Google News plugin

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:

A different feed <–google-news#non-default–>:

Shortcode test non-default [ google-news name="non-default" ]:

Shortcode test default [ google-news ]:

Shortcodes are only available in WordPress 2.5 and up.

65 Responses to “Google News plugin”

Pages: [7] 6 5 4 3 2 1 » Show All

  1. 65
    Mns Says:

    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.

  2. 64
    webmaster Says:

    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

  3. 63
    Michael Kydonieus Says:

    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

  4. 62
    tester Says:

    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?

  5. 61
    domi Says:

    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:

Pages: [7] 6 5 4 3 2 1 » Show All

Leave a Reply

  • Income

  • Current Poll

    Which sub-note are you getting?
    View Results
  • Cloud Nine

  • Current Reading List

    Nation

    Neeeeeeew Praaaaaaaaatchett. It's in the kiddie-series, but they're equally brilliant and I'm sure this one is too.
    Blue War: A Punktown novel (Punktown)

    I've read several books in the same universe now, great stuff. Make sure you start at the beginning though.
    Neuromancer

    I know, I know, should have read it ages ago. I've tried several times but only get to page 50 before it bores me out though. I'll keep trying, honest! :-)