Two line hacks for WP+Gallery+MagpieRSS

After visiting several WP sites with photos from Flickr on the side-bar, I wanted to have photos from my Gallery in the side-bar. Yesterday I found “Gallery-RSS” , a cool plugin for WP from Jon.

This plugin makes use of MagpisRSS, But I couldn’t find a way to read attributes of elements using MagpieRSS,
I temporarily implemented a 2 line hack. Also made minor changes to gallery_rss.php, including lame things like closing “<img />” for valid xhtml :-). Guess that’ll work for time being.


  1. Patched
  2. Patched gallery_rss.php

Please let me know if that is any good.

[UPDATE] – How to use:

Example "<item>" element from my "Gallery" rss.
<item> <link></link> <guid isPermaLink="false">390ac1c329dd7476e22508eaca731e86</guid> <title>Andhra 98 BIET</title> <pubDate>Mon, 3 Jan 2005 02:51:05 -0600</pubDate> <comments> </comments> <photo:imgsrc> </photo:imgsrc> <photo:thumbnail> </photo:thumbnail> <pb:thumb height="98" width="144"> </pb:thumb> <description/> </item>
Example code to access attributes :
// "_mprAttribs" is concatinated with element name (in rss_parse) define('ATTR', '_mprAttribs'); $rss = fetch_rss($gallery_rss_url); // To read "height" and "weight" from <pb:thumb height="98" width="144"> foreach ($rss->items as $item ) { .... $pb = $item['pb']; $pbThumbAtrs = $pb['thumb'.ATTR]; $thumb_height = (double) $pbThumbAtrs['height']; $thumb_width = (double) $pbThumbAtrs['width']

5 thoughts on “Two line hacks for WP+Gallery+MagpieRSS

  1. Hey thanks for this!

    I\’m going to incorporate the changes (since i\’ve been doing others) and make it available…

    thanks again!


  2. I should have read this post once over before emailing you–i notice you also patched *Magpie RSS*…have you contacted them yet?

    for now I\’m going to leave the plugin As-Is until they get the support in there…i presume the Magpie RSS folk would find your \”hack\” useful.

    clever! thanks!


  3. Yes Jon, I mailed them. But that just for fun, yesterday I was so desperate that some how I should access the attributes. I understand that you should keep the plugin working and stable. BTW that was my first ever PHP programming work :-).


    j2 😀

  4. Hi, I’d like to implement your patches to MagpieRSS and to the WP plug in, but your links to the patches seem to yield 404\’s. Can you re-post the patches or email them to me? I\’d really appreciate it! Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *