Avatar britg

all the web, gaming, and foodie stuff that’s fit to printf()

Google Reader Shared Items in WP RSS Widget

I just added a default RSS widget to one of my sidebars and noticed that the links weren’t functioning correctly. The source of the RSS feed is my google reader shared items and I think the format in which google sends the information is different than a normal RSS feed? I don’t know enough about them to be sure. All I know is that for some reason the link to the articles and the link to the sources of the articles are being concatenated together in the widget links.

Here’s a small 2-line fix I came up with if you’re familiar with php and the wordpress framework (version 2.5+).

In your {wp home}/wp-includes/widgets.php find the function wp_widget_rss_output(…). The first foreach() loop in the function should be foreach ($rss->items as $item ) { … Directly after the open curly brace, place these two lines of code:

$parts = explode(’http’,$item['link']);
$item['link'] = ‘http’.$parts[1];

Voila - that fixed the problem for me. All it does is explode the link string by the delimeter ‘http’ and rebuild the link using the first part. It’s not a very extensible solution though, so I would only use it if you just want to use a google reader shared items feed for the source of an RSS widget.

Viewing 2 Comments

 
close Reblog this comment
blog comments powered by Disqus

Passion Projects