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.5.

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…

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.

133 Comments to “Google News plugin”


  1. On sstern.ccim.com/ccim-newsccim-news/, I get “invalid URL” with the plugin. The code is [google-news name="CCIM News"]. It appears that the link generated for a story is

    OK… your board won’t let me post a link. :-(

    It seems that there’s an ampersand missing before “url=”.

    1
  2. Hi Joe!
    Sorry about the abysmal reply time, been moving house. About the filtering. Yes, it’s just a very limited filter support in the plugin at the moment. I could add more features here with very little job, I just wasn’t sure if the filtering was a feature people would bother to use at all. Apparently it is, so I’ll expand it a little. The query method provided by google here is a bit of a pain, as you can’t just give it the old “something+OR+something+else” string. You have to pass individual search parameters to different cgi script variables depending on whether you want say AND or OR. Haven’t looked at the api lately though, so they may have come up with something better.

    OK

    2
  3. Hi Steven!
    Sorry about the late reply, been moving house. Not quite sure what’s wrong based on your error message. I’ll send you an email and see if we can clear things up.

    OK

    3
  4. Cynthia says:

    HELP! My client wants to eliminate the words “Google News : U.S. : All” from the top of our google feed.

    Is this possible? I looked at the coding, but it doesn’t seem very easy to do. If you have suggestions, please share them.

    Thank you! :o )

    4
  5. Cynthia says:

    Hello – can anybody tell me how to REMOVE the words “Google: US: All” at the top of this plug-in? My client doesn’t want it to show up, but I can’t find where the code is.

    Thanks!
    C

    5
  6. Hello friend:

    I installed your plugin and I can see the widget on my blog without any problem.

    However, when I click on the feed links, I get to a non valid address.

    This happens with any news on any link of the google news feed.

    Any idea,

    Thanks a lot

    6
  7. Hi Osvaldo!
    I’ll have a look. Can you provide me with the feed definitions you have? I.e. language, location, etc so that I can replicate your setup here?

    OK

    7
  8. Hi Cynthia!
    In the Feed definition, you have an optional “Admin-defined title”. You can set this to whatever you want. Note that Google Terms Of Use require you to show that the feeds come from Google. Hope this helps.

    OK

    8
  9. This plugin is great! Worked first time, and without coding I made a widget and added to my front page. But: I’d really like to have a second widget, with a different news selection. It seems I can only have one Google News widget — is that right? Or can I make one by putting the shortcode into some other widget?

    9
  10. Thanks, your plugin works perfect, except from news from Norway. Nothing shows up from Norway. Hvorfor ikke det??

    10
  11. When I peview it looks okay, but when I publish, the titles don’t wrap around and the links are not active. WP 2.8.

    11
  12. Hi KenN!
    At the moment you can only have one widget yes, I’ll look into the possibilities of having multiple widgets from the same plugin. But as you say you can use the shortcode and/or WP function calls more or less anywhere you want, so you can get more than one news listing per site that way. The PHP Code plugin (that lets you put arbitrary PHP code into a widget) may also be a possibility here.

    OK

    12
  13. Hi John!

    Fordi :-) As noted in the readme, there are combinations of locations and news types that do not work, e.g that Google do not have an rss feed for. For example, Kenya may not have an Entertainment feed but perhaps a Business feed etc. There isn’t a list of what works and what doesn’t, so you’ll just have to test. The “All” type should work for all locations, including Norway.

    OK

    13
  14. Hi Shawn!
    I took a look at your site, and your posting #196 containing the Google News output looks to be working fine?

    OK

    14
  15. Hi, i being using your plugin , google news ,
    out put i have it set to with image,

    i only see the image but no text displaying
    i have tried using only txt and still only image shows.

    any clues.

    thank you

    15
  16. Hi!
    Thank you for the plugin. It seems to work okay as a widget, but not when inserted in a post. My site displays a summary of the last few posts, and the there are no links – unless you open the post itself. The second problem is that for some weird reason I cant get it to use the ‘long’ version, and I find that the short version is a bit messy. I would love to have a mouseover text-box as you have on this site as well, is that possible? I tried also having us news in the widget and uk news in a post, but it ends up displaying the same one.

    Any ideas how I can solve this?
    And one more thing :)
    Is there any way I can display world news? The CNN plugin wont work, and CNN is still quite US based…

    Thank you again :)

    16
  17. Hi Iris!
    Your first problem, where your summaries do not include links, sounds like a theme-problem. Perhaps your theme strips all links from the summaries? Should be fairly easy to fix if that is the case, but it has to be done in the theme.

    As for the long vs short version, what kind of output do you get from the long version. Nothing at all? Have you tried for “U.S.” and “All”? I’ve never had that problem before, where you get the short but not the long output. They’re just different ways of displaying the exact same rss feed, so if one works so should the other. The messiness comes from Google I’m afraid, they screen scrape news sites and pass the result on to the RSS feed more or less without any cleanups. The plugin does quite a bit of cleanup, but can’t catch all the strangeness that comes along.

    The mouseover textbox is default for the plugin, so if you’re not seeing those on your short-type feeds then I’m pretty sure that’s due to something in your theme and/or CSS-files. The plugin use on this site is completely stock, just unzipped the plugin and defined a couple of normal feeds for testing.

    The CNN plugin doesn’t work for you either, or was that a typo for Google plugin? I’m presuming the latter. Look for an updated CNN plugin in a couple of days, where I’ve added more international feeds. But you will most likely see exactly the same problems there, as both plugins are more or less indentical internally.

    Do you have a web site I can look at to see your problems live?

    OK

    17
  18. mugger says:

    Their TOS seems to say we can’t use their feed on a web page. “You may only display the content of the Service for your own personal use (i.e., non-commercial use) and may not otherwise copy, reproduce, alter, modify, create derivative works, or publicly display any content.”

    I was hoping to select my topics, possibly display as blog posts.

    18
  19. Hi mugger!
    Yeah, their TOS is a bit on the strict side. I’ve vaguely interpreted it in such a way that you can put the feed on a blog as long as you only display the links/short descriptions and not the complete articles, don’t pretend the content is your own (i.e. keep Google/newspaper attribution) and not make too much money off it. But if you’re planning to become a news site and/or fill your blog with complete news articles that someone else have written then you’re way outside their and anyone elses TOS and should consider another approach.

    OK

    19
  20. Hi, I really like the idea of this widget, but can’t seem to get it to work. What am I doing wrong?

    Thanks!

    20
  21. Hi David
    It’s difficult to guess what your problem might be without more information. What happens when you install the widget. Does it show up at all? Have you tried instead adding short-code to a post (or a PHP Exec widget)? Email me a link to a test page where you have added the widget and I’ll take a look. Emailing olav at the obvious domain name will reach me.

    OK

    21
  22. Hi

    Great widget but when I filter the news with ‘Hampshire’ it still displays the same articles…it seems to ignore the filter.

    Thanks

    Toby

    22
  23. Hi, i being using your pluging at the begining , I did an update and the option to be able to see image with txt description .

    Output type: with image Item length: Long
    click on the link so you could see what i get.
    lamaskeproduce.com/?page_id=3421
    My only option is to use Output: with image Item lenght: short to get small description but no image.
    lamaskeproduce.com/?page_id=3509

    But still don’t get no image,

    Thank you , in advance

    Rasco

    23
  24. Hi,
    I am having a problem with the widget. I have numerous feeds defined, but when I select something other than “DEFAULT” and click save, it reverts back to “DEFAULT”. I assumed I am doing something wrong but can’t seem to figure it out.

    Cheers & Thanks in advance,

    Rob

    24
  25. Nice pluging. Thank you.

    How do I make it display in the same font and size as the rest of my sidebar? I’ve tried altering my theme’s style CSS, but I’m not a programmer. Can you help? Thanks again.

    25
  26. great plugin.
    I consider filtering crucial and of significant added value. Thus it would be very helpful if you publish a short ‘guide’ or ‘manual’ on the search strings (query strings) applicable. I am thinking of AND, OR, NOT, compound words as e.g. “financial crisis”, etc.

    Thanks in advance.
    Cheers
    Mat

    26
  27. Hello Olav,

    i use your Plugin on several blogs. Good work.

    27
  28. I have the plugin working fine. One problem I’m having is that I have text only set, but, some stories only have a photo. I do not want stories with photos posted at all.

    Example:
    Post 1. Story text here.

    Post 2. photo only with link to story

    Post 3. story text here

    How can I fix it so that stories without any text will not be posted as a photo? Thanks!

    28
  29. dEstRoyer says:

    my plugin suddenly stopped working. All I get is “Google News unavailable” it returns that when i’m calling a feed that DOES exist. I tried requesting a feed that doesn’t exist and it give me the standard error. This was working one minute, not the next.

    Is the Google News unavailable a common error? are my settings incorrect? any ideas…

    29
  30. I am having the same issue as Bob above…nothing but thumbnails without any description renders the plugin useless as it just displays random pictures on my page!!

    30
  31. If I install this as a widget , all of the other widgets disappear, what am I missing?

    31
  32. L. Scott says:

    Thanks for the plugin. I’m new to WP and BP so this helps me alot.

    I can’t seem to get the query filter to work. Is there a certain way the words go in the query? I’ll use the word boxing…I’ve tried it as…Boxing…”Boxing”…[Boxing]…=Boxing…’Boxing’…none have filtered the category.

    I’m new to all this so be gentle.

    Thanks

    32
  33. I’m using your plugin as follows:

    Call with PHP using “php shortcode” plugin within “section widget” plugin.

    Works beautifully, including multiple instances.

    BUT!

    It fails to refresh. The cache time had been set to 300 seconds. I reset it to 1800 seconds, wondering if perhaps it was trying to refresh too frequently.

    No luck so far.

    Any thoughts?

    33


Leave a Reply

  • Hit me

  • Current Poll

    Which sub-note are you getting?
    View Results
  • CNN News
    Special Programming (video)