Publishing External RSS Headlines to Your WordPress Site

I wouldn’t advise republishing content from any old RSS feed, but sometimes there’s a reason.

Let’s say in addition to DarrenHoyt.com, I also owned DarrensMusicNews.com, and I wanted to display those headlines in this blog’s sidebar. There are plugins to accomplish this, and sweet RSS/XML parsers like SimplePie, but WordPress already comes with a function to handle it — this can be seen on your WP dashboard page where headlines are pulled from the Planet WordPress feed.

That dashboard code lives in /wp-admin/index-extra.php, which is where I took fragments and rewrote it to a simpler snippet:

<?php
require_once (ABSPATH . WPINC . '/rss.php');
// insert the feed URL here
$rss = @fetch_rss('http://www.darrensmusicnews.com/feed/');
if ( isset($rss->items) && 0 != count($rss->items) ) {
?>

<?php } ?>

Give it a try. The code is mainly valuable for interlinking multiple sites you may own (check out the “Recently on the GigaOM Network” module in the footer of GigaOm.com. That can also be accomplished with the BlogNetworking plugin).

If you do decide to parse/publish someone else’s blog feed, it’s best to get permission first and give proper credit, and don’t just do it for crummy advertising dollars :P

  • http://hoei.com TheOzz

    Thanks a bunch. I just tested the code and it worked like a champ. It will need a little CSS styling, but hey, it works. I have been looking for this type of a solution and did not even think to look at the WP dashboard code. cheers!

  • http://cssherald.com Wallace

    hello, Darren,
    it’s very useful for me,
    but how can i integrate 2 or more feeds?

  • milo

    Looks similar to 06 Jericho One method…

  • http://www.cvillepodcast.com/ Sean Tubbs

    Thanks! I’m adding headlines to all of my sites as a result…

  • Starling

    I would also like to know how this works if I want to add more feeds. The example is just one.

  • Darren

    @sean: I actually thought of you when I wrote that, on account of your networked Podcast sites. Hope you find it useful.

    @milo: Thanks for the link. That ‘current_time’ bit could be really useful.

    @wallace and starling: Are you guys asking about multiple lists of unique feeds or combining multiple feeds into one? The first solution can be done by simply copying that snippet several times with several different RSS feeds, and for the second solution, if you want to pull from an aggregated feed, you can use the plugin I mentioned, or use a service like Yahoo Pipes to create your own.

  • Starling

    The latter. Thanks.

  • http://www.franciscopolo.com Francisco Polo

    Have you ever tried Feevy.com?

    It’s exactly the same idea but much more easy and practical! Take a look!

    :o)

  • Pingback: Seth Holladay » Links » links for 2008-01-31()

  • edi

    hi darren,
    i tried your code and it works fine except that it doesn’t work if feed URL is something like : http://www.mysite.com/blog/index.php/feed/
    can you help in sorting this out? thanks if you or anyone else can help ..

  • Darren

    edi: There are many ways an RSS URI is formed, but so long as you use the absolute path to the feed you’re parsing, it should work fine. Do you have a specific link to a feed that’s not working?

  • edi

    thanks darren.
    the feed link i am talking about is this one : http://www.korculainfo.com/blog/index.php/feed/
    also, what i just noticed, when i tried to place code in the sidebar of the same blog (www.korculainfo.com/blog/), – the code doesn’t work – it does not display any feed from any site ( i tried with several feed urls)
    so, i guess, this must be a problem going ‘both ways’..

  • Darren

    It looks like that blog doesn’t have WP installed in the root folder, but in a place called /blog/. If that’s so, you need to change the path to /rss-functions.php to wherever that file is actually located.

    Funny you linked to Korcula, I’m thinking about spending my summer there or in Zadar (or somewhere in Montenegro), if I can find a room to rent and a reliable internet connectoin.

  • edi

    darren: as i have the old version of wp on running that blog, i had to change the path to /rss.php instead to /rss-function.php and it works now.

    however, feeding different site with the feed from this blog stil doesn’t work for some reason …

    re your holidays & reliable internet connection – it shoudn’t be a huge problem, as there are rooms/hotels that offer that service.
    if you decide to come in korcula , get in touch..
    thanks for your help :-)

  • http://www.thanksalgore.com/ Bart

    Great post. I was trying to do this myself with no luck. So thanks. :)

    I did have a question though:
    Is there any way to add the date of the item?

    Thanks again.

    Bart

  • http://www.thanksalgore.com/ Bart

    One more question:
    Is there any way to stop the feeds from caching or at least set the intervals?

    Thanks.

    Bart

  • Darren

    Is there any way to add the date of the item?

    See milo’s comment further up.

    Is there any way to stop the feeds from caching or at least set the intervals?

    Hmm, I’ll look into that.

  • Pingback: Looking for Wordpress module / plugin - Affiliate Marketing()

  • http://antone.geckotribe.com/alpha-gecko/ Antone Roundy

    If you want to display RSS feeds within your posts (so you can choose a different feed for each post, for example), there’s a new WordPress plugin that uses CaRP to do it:

    http://www.geckotribe.com/rss/carp/CaRP-WP/

    CaRP does cache the feeds, and you can set how many minutes you want it to be cached before getting refreshed (the default is 1 hour). The relevant setting is “cacheinterval”.

    CaRP is available at:

    http://www.geckotribe.com/rss/carp/ (commercial version)

    and:

    http://www.geckotribe.com/rss/rss-to-dollars/ (free version)

  • http://jerseysandhockeylove.com/blog Tapeleg

    This looks like something I would like to add in to a new site I want to create, combining the new membership directory approach, and allowing a feed to be displayed of the member’s last five post headlines. This would require using a custom field to publish the individual RSS address to the individual post for that member. I know how to create the custom field, but I tried a few ways to put that field into the code you have, and I could not get it to work. The code works with a static address, so I cut and pasted it in properly. What do you think? Any advice?

  • http://germworks.net/blog Jermayn Parker

    Thanks for this bit of information, I spent an 1.5 hours tryingt o do this and every other Plugin I tried was useless!

    Thanks again!

  • http://blogg.kiona.se kiona

    Hello
    This seems to be something I’d like to have on my blog, showing in my sidebar. But I’m not very familiar with php so could you pleas tell me where to put it, as exactly as possible.

    /kiona

  • images in rss

    as many have stated, this works way better than anything else i’ve seen out there.

    i’m using it to place images from a photoblog on another site, but as the script is written, the images don’t show up, just the headline. i’ve checked the rss feed, and in FeedDemon the images are definitely coming through — so what do i have to add to the above to make images come through for me on the site?

    also: is there an easy way to place the rss parsed images (thumbnails) horizontally? (trying to put them across the top of a page full of content below)

    any help from ya’ll would be appreciated.
    thanks.

  • Darren

    That chunk of code I provided looks for certain elements within the XML document (like ‘title’, which is what pulls down the headline). To get images to show up, you’d need to inspect the RSS feed in question to see how it includes images, if it indeed does. You can always write little scripts that pull down feeds and customize their output.

    • http://dodgepark.com/buildout Wes

      Hi Darren, or anyone who could help.

      I am working with the icompany theme, which I am having trouble with the jtabber.

      What the client wants to do is have blog categories post to the jtabber on the right.

      Thing is, nothing shows there except recently viewed posts and posts that were recently added.

      Is there anyway to make particular categories show up on the jtabber or is it not possible?

      Can someone please help me?

  • http://www.subcorpus.net/blog/ subcorpus

    21 already kinda tried what i’ve been trying to do …
    still … if anyone knows of a plugin which can display thubnails of images from aminus3.com … that’d be nice …
    thanks …

  • http://www.derekrogerson.com Derek Rogerson

    ‘rss-functions.php’ is depreciated; use ‘rss.php’ instead

  • http://davemora.com Dave Mora

    This works like a champ but it dies over when people are using ASP for their feeds. How I hate .aspx feeds. :)

  • http://12-design.com 12-design

    Works great! Thanks a lot!

  • http://connectsimply.com/blog Heidi Caswell

    I can get it to work, almost. adds a ? to the end of the url link in the headlines.

    How do I get it to leave the ? off

    Thanks!

  • http://connectsimply.com/blog Heidi Caswell

    Fixed, one quote in the code I copied had wrong slant. Thanks so much,

  • http://www.vuelgdxak.mpotsl.com ryzjcgx kcbdjzt

    krxbs csfeqt orwgb vkqtfwnc rybz mioxgsw rtajhlgv

  • http://www.ampota.com Ranniel

    the code is great! is there in any way i can pull the custom field values for those feeds? I added ID, "product", $single = true); ?> but it didn’t display anything. Hope somebody can help me with this. :)

  • pd

    Do you have a version of this that would work on a non wordpress site?

  • http://www.vcventerprise.com/wp chris

    Hi Daren,
    Great article but (sorry I’m a newbie) how would you take that and integrate it into a post instead of putting the headlines on the side bar of your blog?
    I just want to include interesting news articles on my site, just have a post each day with a mix of different rss feeds. Any help as to how I would accomplish this is greatly appreciated!
    cheers

  • derekr

    This script has stopped working. The rss feeds no longer update. Stopped updating about a week ago. Anyone else see this?

  • Jennifer Wilson – Agent Solutions

    Hey Darren,

    I think this is what I am looking for although I have a few questions for you. I notice the last comment before me says it is no longer working, is there a problem with it I should know about before I give it a try?

    I can’t wait to see if it works on my site.

  • Pingback: WordPress Developer’s Toolbox | Developer's Toolbox | Smashing Magazine()

  • Darren

    The code sample has been fixed and updated, thanks for the heads-up.

  • Derek R

    Well, it stopped working for a week or two for no apparent reason (my rss feeds were updating fine) and now it’s started again. I’ll keep an eye on it and report back here. Previously it worked fine for the initial 2 months I’ve used it.

  • Jennifer Wilson – Agent Solutions

    The theme that I am using for my new site has a tabbed section on the right sidebar that has “Recent” and “Popular” sections for blog posts. The code for the section is in the jtabber.php file.

    Will this code work if I put it in the jtabber.php file or does it have to go in the index-extra.php file?

    This is the link to theme if you want to see what the tabs are like:

    http://icompany.ithemes.com/

    Any help in the regard would be greatly appreciated.

    Thanks.

  • http://www.tlmarketing.net/2008/09/16/3-ways-to-monetize-your-rss-feed Tom At The Home Business Archive

    Thanks for the information.I have been looking into different ways to monetize an RSS feed, perhaps it could be done by publishing external RSS headlines?

  • Darren

    @Jennifer: I haven’t seen the templates for that theme so I couldn’t really answer. The code would just need to go in place of wherever the current “Recent” or “Popular” hooks are currently.

  • Jennifer Wilson – Agent Solutions

    Thanks Darren, that’s all I needed to know. They are in a jtabber.php file. I will put it in there and see if it works.

  • Pingback: WP开发者资源-2.10: WordPress Feed高级应用 | 帕兰映像()

  • Pingback: WordPress Developer’s Toolbox | rafdesign()

  • http://gadgetheat.com GadgetHeat

    Hi Darren

    Great site and thanks for the snippet but I am not sure how to get it to work?

    I want to have this on a page of its own rather than in the side bar, how do I do that?

    I am working with wordpress 2.6.2

  • http://josetokyo.blgospot.com josetokyo

    great post!
    thanks!!
    say

  • Pingback: Wordpress Araçları - Ä°ngilizce | indirazzi.com BETA()

  • http://www.blackinternetmarketing.com Brandon

    This is great! I used this code to connect two of my blogs and NEVER had to ask the blog authors for permission! :-)

  • Pingback: WordPress Developer’s Toolbox - 山歌好比春江水()

  • Pingback: WordPress 开发者工具箱1 | Ruijin Ubuntu Blog 生活中的每一点点滴滴......()

  • Pingback: WordPress 开发者工具箱()

  • Pingback: 逐浪·网络 » Blog Archive » WordPress 开发者工具箱()

  • Pingback: - WordPress 开发者工具箱(上)【联讯网】()

  • Pingback: WordPress Developer’s Toolbox | Fusuy.com || Webmaster Accessary Platform()

  • Pingback: cssframework » WordPress 开发者工具箱【完整版】()

  • http://www.balebali.com bali villa

    thanks.found similar post but your’s is a lot more easier.thanks

  • Ray

    Would it be possible to provide thumbnails as well? I have one blog that uses custom fields in WordPress that displays thumbnails for each post on the front page. If I have another blog that I would like to display the same thing from that first blog, would that be possible using the builtin WP method?

    For example, take a look at

    http://www.enavant.com/features/

    If I want to display the same thing their frontpage is displaying, showing and linking to their articles of course, how can I do so?

    Any help is much appreciated

  • http://webmatze.de webmatze

    Thank you very much! This was exactly what I was looking for.
    I integrated that script into my page so you can see how it is working now.

  • http://www.hidradenitisuppurativa.com Hidradenitis Suppurativa

    Thanks for the helpful post. How can I publish RSS on an individual post rather than a sidebar?

  • Pingback: 135+ Ultimate Round-Up of Wordpress Tutorials | About Us | instantShift()

  • Pingback: 250 Wordpress Tutorials()

  • http://nyherald.com Steven

    This is great, thank you. I’d like to display my twitter’s latest feed using your method, although I’d like to ask about proper syntax if you want to have it display by category, e.g.:

    if category = 12, rss feed =
    if category = 9, rss feed =
    all else, rss feed =

  • Pingback: 135+ Ultimate Wordpress Tutorials()

  • Pingback: RR [dot] net / How to publish RSS feed into your blog site()

  • http://dodgepark.com/buildout Wes

    Hi Darren, or anyone who could help.

    I am working with the icompany theme, which I am having trouble with the jtabber.

    What the client wants to do is have blog categories post to the jtabber on the right.

    Thing is, nothing shows there except recently viewed posts and posts that were recently added.

    Is there anyway to make particular categories show up on the jtabber or is it not possible?

    Can someone please help me?

    Wicked appreciative is someone could help

  • Pingback: 250 Wordpress Tutoriels et liens pour tous | Guppytrucs Freeware()

  • Pingback: WordPress Developer’s Toolbox | 9Tricks.Com - Tips - Tricks - Tutorials()

  • Pingback: Mateus Neves, Designer, Wordpress and more » Blog Archive » Publicando conteudo via RSS externo em seu blog()

  • Pingback:   WordPress Developer’s Toolbox  by Oshoamy()

  • Pingback: Wordpress tutorials - Gurushala()

  • kailoon

    Can we also call the image of the posts?

  • http://www.kpsscdegitim.com cd

    Very useful information, thanks!

  • Pingback: 135 link cung cấp thủ thuật wordpress hot nhất | Giải Pháp SEO Internet Online Marketing-SEO consultants()

  • http://findcheapbargains.com Brian

    I’m a little late to the party since you published this in 2008, but it seems to suit my needs for a quick and dirty task I am trying to accomplish. I normally use Carp, but not having to install that and just use this instead made it much more simple. Many thanks!

  • Pingback: 136 Massive Wordpress Tutorial Collection | WebCoreStudio()

  • Arfa

    Hi,

    When I use your code in my blog’s sidebar, it gives me the following error.

    ======================================
    Fatal error: Call to undefined function _deprecated_file() in /Users/admin/Sites/dealmagic/wordpress/wp-includes/rss.php on line 18
    ======================================

    I am using the following RSS feed
    http://www.dealmagic.com/delhi.rss

    Can you please point out what might be wrong.

    Thanks

  • Pingback: 135 webs/blog for wordpress tips |()

  • http://www.albiavilla.com Bali Villas

    Funny you linked to Korcula, I’m thinking about spending my summer there or in Zadar (or somewhere in Montenegro), if I can find a room to rent and a reliable internet connectoin.

  • Pingback: 135 trang web/blog thủ thuật wordpress hay nhất | iTViệt.VN - itviet.vn - Cổng thông tin dành cho giới trẻ Việt Nam()

  • Pingback: 135 trang web/blog thủ thuật wordpress hay nhất « mockhangnoithat()

  • Pingback: 135 TRANG WEB/BLOG THỦ THUẬT WORDPRESS HAY NHẤT « Carton Boxes Packing (bao bì Carton)()

  • http://www.realestatewebsites.com Eric

    Darren, this is a good one, thanks. Was actually looking for exactly this. Now off to go test it! I just tried using one of WP’s built in ones and was NOT what I was looking for lol…thanks for the read