Kolbu

Computers, Gadgets and Beyond!
Subscribe

CNN News plugin

April 03, 2008 By: webmaster Category: WordPress Plugins

CNN has a number of RSS feeds with current news available, on a number of topics.

This plugin works both as a widget, as inline content replacement and can be used in themes. It can be used as all three simultaneously, but there can be only one instance of the widget. Multiple feeds can be configured and used accordingly. Clicking on a news item will of course take you straight to the relevant article at CNN, as per CNN Terms of Use.

I know there are generic RSS feed widgets out there, but I figured with so many CNN feeds they warranted their own widget with easier configuration than your average generic RSS widget.

NOTE! Always upgrade to the latest version if you experience problems, most things are fixed already. :-)

The latest version is 2.2.

Download CNN News plugin


Known bugs: See the Google News plugin post. These two widgets are virtually identical, so bugs also tend to be the same in both.

Let me know if you find bugs, or if you want additional features or changes. Admin-selectable news item look, extra class/id for CSS etc.

NEW Edit/Delete of feeds do not work under WordPress 2.7. I’ll release a fix as soon as I can. If you’re adept at editing PHP code, you can try out a temporary fix. Edit cnn_news.php and replace all references to edit.php with tools.php and see if things go back to normal. Let me know!

30 Responses to “CNN News plugin”

  1. 1
    couchmouse Says:

    Thanks for the plug in. The only problems I had were server side. My servers firewall blocks ALL fopen requests unless added to white list. These are the addresses I had to whitelist to get it to work for anyone else who might have a problem.

    edition.cnn.com
    rss.cnn.com

  2. 2
    Paul Says:

    Hey, any chance you could set up a similar or the same plugin for Google News? What’s cool about them is that you can do a search on Google News for whatever topic you want, and the search results page is ALSO an RSS feed… meaning someone could have a custom setup for their particular page’s topic(s).

    Barring that, have a suggestion on which generic RSS feed widget is best for WordPress use?

    Thanks!

  3. 3
    webmaster Says:

    Thanks couchmouse! I’ve added a small note in the readme about firewall settings.

  4. 4
    webmaster Says:

    Hi Paul!
    A similar one for Google News can certainly be written. These widgets are fairly easy to churn out once you get past the initial hurdles. I’ll see what I can do!

    As for generic feed widgets, I did install a couple and checked them out but I didn’t really like any of them. Try FeedList, FeedCache, FeedSnap or RSSImport. Don’t be too surprised if they’re not exacly what you’re looking for though.

  5. 5
    webmaster Says:

    And the one for Google News has now been written. See plugin-repository at wordpress.org.

  6. 6
    John Says:

    hey couchmouse:

    I think I’m running into the same blocked requests. My question (’cause I’m barely web-literate) is: How do I find the white list option you mention?

    Thanks
    John

  7. 7
    couchmouse Says:

    @ John
    1. Your host has to allow/enable php fopen so your website can connect to cnn.
    2. The firewall is on your hosts server and you have to ask support to allow/whitelist the IP address you want to connect to. ie. edition.cnn.com and rss.cnn.com

  8. 8
    braddock Says:

    I loved your plugin. I installed it yesterday and everything looked great for for 4 hours or so. Later I pulled up my site and my posts were gone. I was getting the following error under the Google News widget:

    Fatal error: Call to undefined function debug() in /html/wp-includes/rss.php on line 504

    I deleted the feed and added a new one. My posts were back but now I’m getting this error under the widget:

    Google News unavailable

    This makes me think Google changed something on their end. I hope this isn’t specific to me.

  9. 9
    Jeff Says:

    This only happens occasionally and doing a refresh gets rid of it but I’m concerned that visitors to my blog will not know that. When it happens it plays havoc with my template. A new visitor may think it’s my design when in fact it’s the plugin. What happens is that I ocasionally get this error message, “Call to undefined function debug() in …. /wp-includes/rss.php on line 504″. I don’t mind if it’s related to the feed but would like to see a message result that states an error resulted and to refresh the browser to reset it. Other than that I love both this and the NASA Image of the Day plugins!!!

  10. 10
    webmaster Says:

    Hi Jeff!
    Not much I can do about the error in line 504 in rss.php, as that is a WordPress file. I’ll see if I can file a but report with the guys. And I suspect that a PHP error will have a few html-codes around it, which is probably why you’re getting a strange layout when that happens.

    Or do you get a template mess without the error as well?

    OK

  11. 11
    webmaster Says:

    Hi braddoc
    The debug() call appears to be a bug inside WordPress, I’ll see if I can track it down and report it. The RSS support inside WordPress is a complete mess, and I might end up rolling my own instead of relying on WordPress functionality there.

    OK

  12. 12
    Andrey Says:

    Hi,
    Inserting into index.php of my custom theme gives
    “Warning: Invalid argument supplied for foreach() in /hsphere/local/home/xzamen/my.xzamen.info/wordpress/wp-content/plugins/cnn-news/cnn_news.php on line 622
    No default feed available”
    However using it in single.php works fine. But I really need it in index.php. How can this be fixed?
    Thanks.

  13. 13
    Andrey Says:

    Oops, php code disappeared :) I am inserting do_action(‘cnn_news’)

  14. 14
    webmaster Says:

    Hi Andrey!
    That looks like a bug. I’ll send you an email with a bugfix for you to try out.

    OK

  15. 15
    DataGnostics Says:

    Dear Webmaster:

    I’m getting the same error Audrey is. Can I get the same fix?

  16. 16
    Brad Hart @ A DoFollow Blog Says:

    It is a nice plugin, any chance on the next version having a digest post feature?

  17. 17
    webmaster Says:

    Hi Brad!
    Do you mean something that would post a snapshot of the current news to a posting once in a while?
    OK

  18. 18
    Dillon Says:

    Hi,
    I’m testing your CNN widget on a new blog I have just launched, but am not happy with the display of the 5 CNN news links. These links appear as one large block paragraph, without any indication where one link ends and the other begins. I’d like to insert a small image at the start of each news link to clearly define each link. But when I tried inserting the image code into the cnn_news.php file at the place I presumed to be correct, it prevented me from activating the plugin. Instead I got a “fatal error” message. Can you tell me exactly where and how to insert this image before each news link?
    Thanks – am looking forward to hopefully resolving this!

  19. 19
    webmaster Says:

    Hi Dillon!
    You can add separators without editing the plugin source. The plugin itself is wrapped in a LI-tag with the id=”cnn-news”. The link-set is wrapped in an UL-tag (no id) and the individual links are all LI-wrapped. (View the page source on a page showing the plugin). You can use this information in your CSS file to say have a big bullet-like graphics in front of each link. As for the “fatal error”, you have most likely made a syntax error in your PHP-code. Se your webserver error log for additional information on what you did wrong. Hope this helps!

    OK

  20. 20
    crandall Says:

    Greetings,

    Having trouble with the plug in. Running it as a widget. Runs fine if I don’t mess with it, but once I try to edit it (i.e. show only business feeds) it displays “feed unavailable.”

    Am I missing steps in the process? Using WP 2.7

    Thanks.

  21. 21
    webmaster Says:

    Hi crandall!
    Hm, not quite sure what that could be. Note that Google does not have a full list of feeds, so business may or may not be available as a sub-choice in your language. However, if you use english on your site it certainly should be. Can you try some of the others to see if it’s a general problem or not?
    OK

  22. 22
    Rolando Says:

    I tried replacing edit.php with tools.php and it didn’t work. I am running WP 2.7.1

  23. 23
    webmaster Says:

    Hi Rolando!
    Can you try the latest version of the plugin, it should be compatible with the new WP file layout without you having to edit anything. Running it here under 2.7.1 and that seems to work fine.
    OK

  24. 24
    Rolando Says:

    Hello,

    I just checked my version of CNN plugin and I’m using version 2.4 which is the latest. Latest on your site is version 2.2. Should I try your version?

    Thanks!

  25. 25
    webmaster Says:

    Hi Rolando
    Naa, that’s just me being slow. There is very little difference between 2.2 and 2.4, mainly the 2.7 series compat fixes. And I’ve implemented those by hand. So what looks like the 2.2 on the outside is really a 2.2 modified with the 2.4 changes. Could you describe in more detail how you’re using the plugin and what it is that doesn’t work? Email to olav at the obvious domain will also work if you want to write long.
    OK

  26. 26
    Paul McParland Says:

    I am trying to implement this on a content page. I tried both plugins and neither seem to work. I am using WP 2.8.1 version. What could be the problem?

  27. 27
    webmaster Says:

    Hi Paul!
    Tricky to say with so little information. Can you email olav at the obvious domain name with a link to the page you’re trying to add the plugins on? And some information about what kind of error messages you get. Have you tried the widget form as well, not just adding the short codes to a page/post? Same problem there? The two most common problems are too restrictive php-configurations and your hosting provider not allowing outbound connections. The plugins obviously need to fetch information remotely, so they need to be allowed that.

    OK

  28. 28
    Shannon Says:

    Hi, I feel kind of silly asking this but is it possible to make the feed appear on a static page and not on the sidebar? I would really like to use it as content, not just a sidebar feed. I tried copying the code into the html on a page, after installing the widget into the sidebar. Am I doing something wrong? Is this an option-to have the feeds on a page as opposed to just the sidebar?

  29. 29
    Craig Delsack Says:

    [WEBMASTER - PLEASE DELETE LAST POST - MY URL INCLUDED MY SITEMAP BY ACCIDENT]
    Wow. Great Plugin! I like the trick to rotate stories, by keeping the name and title for the feeds the same. It would be great if 2 feeds could be combined, or better yet, interwoven (but would that be a function of the RSS feeder?).

  30. 30
    Karl-Heinz Says:

    Thanks for the great plugin! I listet it on my site.

Leave a Reply

  • Income

  • Current Poll

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