Wordpress Google Reader Plugin
I have wanted to display items marked as “shared” from my Google Reader on my blog for a while and today I finally sat down and wrote a plugin to do it. You can download the source at http://mike.crute.org/downloads/reader_shared.phps
I wrote the plugin with the following two assumptions: you must have a copy of PHP with SimpleXML and you must have url_fopen set to true. I also do not do any error checking on the settings page so if you feed it bad settings its likely to bomb in a very un-graceful way.
To use it just drop the code in your wp-content/plugins directory and set the settings on the Options page. Then modify your template and add a call to readerShared(); wherever you would like to see the listing of your shared items.
The “I’m Reading” box on the right hand side of this blog is powered by this code.
Update (1/17/07): The Google Reader folks where nice enough to point out my little Wordpress plugin on their blog. If I get enough interest I would entertain maintaining and extending the plugin. If not, it still suits my needs.
Any plans on releasing a Widgetized version?
Cesar Cardoso said this on January 17th, 2007 at 3:40 pm
I’m not sure what kind of widgets you’re talking about (everybody has widgets these days). If it would be useful I could probably widgetize it.
-Mike
Mike Crute said this on January 17th, 2007 at 4:38 pm
A widget would be fine, to integrate it directly to a k2 based wordpress theme, and those who use widgetable theme. Good job.
Fatih Arslan said this on January 17th, 2007 at 6:52 pm
Awesome! Will set it up in a couple of days. I have been wanting to do the exact same thing. Thank you.
Jon Molesa said this on January 18th, 2007 at 2:06 am
Mike, thanks for contributing by writing this plugin!
I will install it on my blog in a few days as well!
May I suggest that you mention a “running example” on your post? I assume that the section “I’m Reading” on your blog was generated by your plugin, but I will only be sure once I install it and test it myself.
krico said this on January 18th, 2007 at 3:58 am
Just what I was looking for. I experimented with creating a page and putting an iframe there but that didn’t look good.
Anyways I have a question regarding your assumptions:
How can I make sure that “url_fopen” is set to true?
It would really help if you could provide more detailed walk through of installing and using this plugin.
AL said this on January 18th, 2007 at 5:16 am
Hi,
Thanks for the idea to include the list of shared articles on a WordPress Blog.
However, if your host doesn’t allow the SimpleXML PHP functions, here is a little trick:
* In Google Reader, create a clip of your shared items with the following settings: Title=” & Color scheme=’None’.
* In your WordPress template, include the code provided by Google Reader which outputs style list that you can handle with CSS
See the example at the end of my blog (ok … in French but still, at the bottom)
Enjoy…
Tomv said this on January 18th, 2007 at 8:08 am
great plugin. i am looking for something similar for typepad. any suggestions?
Bimal Shah said this on January 18th, 2007 at 2:59 pm
When I go to Options -> Google Reader, a blank screen is show. Any ideas?
Marco Raaphorst said this on January 18th, 2007 at 3:59 pm
Al - the plugin is designed to go directly into a template, not in an iframe. You can set url_fopen in your php.ini file or use ini_set()
Marco - do you have SimpleXML and PHP5?
Mike Crute said this on January 18th, 2007 at 5:40 pm
Great idea for a plugin Mike!
This is driving me up a wall though, when I go to access the Options page I get this:
Fatal error: Cannot redeclare readershared_menu() (previously declared in /home2/*username*/public_html/wp-content/plugins/reader_shared.php:64) in /home2/*username*/public_html/wp-content/plugins/reader_shared.php on line 65
Thoughts?
David Morgan said this on January 19th, 2007 at 12:33 am
readerShared_Menu is the function that add the admin menu, it is the last function at the bottom of the code. In the original code it is only declared once. You’re welcome to email me what you have have and I’ll try to help I’m mcrute over at gmail.
Mike Crute said this on January 19th, 2007 at 8:39 am
I don’t use WordPress or Google Reader, but my girlfriend does and was
interested in this. And thanks you! But we don’t have url_fopen
enabled, and so I have added support for cURL. Also, we had the same
problem (”function already defined”) as David Morgan. Perhaps
wordpress, or a particular version of it, reads in the file more than once, so I surrounded that (and
other functions that I made) function definition with an
!function_exists(…)) { … }
. I’ve also added the option to
excerpt content from each feed. You can find my modifications at http://jeremy.smallinfinity.net/wordpress/
and see it in action at http://scriniary.smallinfinity.net/blog/.
Hopefully all the bugs are out…
Jeremy Michelson said this on January 19th, 2007 at 1:59 pm
For those wanting a widget version of this,
-Simply get the RSS link for your google reader shared page
-Go to the edit sidebar widgets in wordpress dashboard
-Add a rss widget to the sidebar
-Paste the the above RSS link in to the RSS widget options.
Voila. Your Google reader shared page for all to see on a RSS feed.
The Boy Who Likes To said this on January 23rd, 2007 at 11:20 am
First of all many greeting Mike, this plugin is very intersting.
I have download latest version of this plugin and I’ve uploaded it into my blog which running on Wordpress 2.0.7.
I’ve switched on the plugin configured it with its panel and edited the sidebar template.
But nothing else. When I update the main page I can’t read any sharing feeds.
If I open the link that I have used of my google reader sharing feeds all working fine.
Any suggestion about this problem?
hjogi said this on January 24th, 2007 at 10:46 am
Hi HJOGI… The plugin works on WP 2.0.7 (thats what I was running up until yesterday). Are there any PHP errors on the page or does the page fail to render fully? Also, make sure you are pointing at the ATOM feed for your SHARED items, if you try to point the plugin at a private feed (like your starred items feed) or a non-atom feed you won’t see anything. Let me know if that still doesn’t work.
Mike Crute said this on January 24th, 2007 at 11:22 am
This is amazing. I’ve been looking for something like this for a while!
amish said this on January 25th, 2007 at 10:59 am
I’m getting the same error as commentor David Morgan did above. I sent you an email but wasn’t sure if you got it. Do you know of any way to resolve that issue?
amish said this on January 27th, 2007 at 4:19 pm
Hi Amish… take a look at the comment by Jeremy Michelson. He just wrapped the function def in if(!function_exists(…)) { … } that should solve the problem for you.
Mike Crute said this on January 27th, 2007 at 9:14 pm
Would love you to package this in a way that made it accessible to technical novices, like me, who don’t know what it means to “have a copy of PHP with SimpleXML and url_fopen set to true”. I tried opening the file above, saving it as a text file the ftp-ing it to my wordpress 2.1 plugin directory where I activated it. And recieved a scarey error message so I took it out because I obviously have no idea what I’m doing.
I’e wanted something that does this since my baby-blogging days on msn spaces….
Thanks
::Wendy:: said this on February 5th, 2007 at 12:06 am
Thanks for a cool plugin! I’ve just discovered Google Reader today (I know! Where have I been?) and will be adding this to my site this evening. Very nifty!
Thanks for making it available!
Del Simmons said this on February 6th, 2007 at 4:24 pm
It appears that Google has changed their XML format, which is breaking the links in the sidebar. A solution is to remove the “
” from the argument “
” in the printf near the end of the file:
[1]['href'],$item->title,$item->source->title);This will work at least until Google changes the format again…
Jeremy Michelson said this on March 21st, 2007 at 9:21 pm
After reading this post, and then writing a similar one about my struggle to implement a plugin similar to yours I noticed you may not really need a plugin.
If you select the ‘none’ theme when selecting the style from Google Reader it just produces standard ul/li tags. All you have to do is apply your style to them and it will have a similar affect.
Check out the post below (more specifically, the UPDATE section) to get more details.
Using Google Shared Items in your Blog
Doug said this on March 28th, 2007 at 11:48 am
Thanks for the tips! This works great!
david said this on May 22nd, 2007 at 2:20 pm
Nice widget. I’ve been looking for something like this.
Hosting Reviews said this on July 16th, 2007 at 4:49 pm
Found your plugin before I came across Google reader! Now am a fan of both!
Clive said this on July 23rd, 2007 at 5:35 am
Thanks for your advice. This is great stuff.
Izrul said this on August 31st, 2007 at 1:49 am
Nice Site!
dada said this on September 30th, 2007 at 7:29 am