• Home
  • About
  • Work
  • Rest
  • Play
  • Contact

Tutorial: Getting FlickRSS working with Lightbox 2 in Wordpress

Recently I was asked about getting a Flickr RSS feed to be put onto a website for Flickr Logowhich there is a wonderful Plugin for Wordpress already written by Dave Kellam. I was then asked if it was possible to have these images which were dragged from Flickr used in a LightBox. Fortunately there is already an excellent plugin called Lightbox2 which we’re able to utilise. With a few very simple modifications to the FlickRSS code, we got what we wanted! (You can see an example of this in the Footer of all of our pages under “…elsewhere”. Here’s a tutorial on how to achieve just that.

  • First, download and install the 2 plugins [FlickrRSS and Lightbox2]
  • In the flickrrss.php file which you’ll find in your Wordpress Plugins directory (/wp-content/plugins/flickrrss/flickrrss.php for example) you need to find the line [no. 110 for us] which reads:
    print $before_image . "<a title="\&quot;$title\&quot;" href="\"><img src="\" alt="\&quot;$title\&quot;" /></a>" . $after_image;
  • You need to modify this line so that LightBox2 knows that it is a link which it should handle. You do this by adding a rel=”lightbox” so that line should now read:
    print $before_image . "<a title="\&quot;$title\&quot;" rel="\&quot;lightbox\&quot;" href="\"><img src="\" alt="\&quot;$title\&quot;" /></a>" . $after_image;
  • As it stands, (if you were to set $img_url = $imgurl) when you clicked on an image from your feed your lightbox would pop up but the same image would be displayed. This isn’t ideal as we want a larger version of the thumbnail to get put into the LightBox, so we need to alter the image url
  • Directly above the line of code we have just altered, create a new line which has the following:
    $img_url = str_replace("_s.jpg", ".jpg", $imgurl);
    $url = str_replace(”_m.jpg”, “.jpg”, $imgUrlMatches[1]);
  • This now gives the Lightbox the bigger “medium-sized” image link from Flickr instead of the thumbnail

And that’s us done! Save all of that and you should have a working Flickr RSS feed with Lightbox2 integration. Thank you to the writers of both the Plugins used and of course the wonderful people who create Wordpress and keep it at the best possible price…nadda!

Update: Lynn, in comment 3, has informed me that the original code didn’t work with the new version 4.0 of FlickRSS.  She also, rather nicely, has figured out how to edit the code to make it work!  Bravo!  The code above should now work with the new version of FlickrRSS 4.0!


3 Responses to “ Tutorial: Getting FlickRSS working with Lightbox 2 in Wordpress ”

  1. lynn, on August 22nd, 2008 at 7:59 pm Said:

    Hey Richard,

    Nice little tutorial. Any mods for flickrrss v4.0?? I can’t seem to figure it out and I’m killing myself. :)

    MTIA

  2. Sticky, on August 22nd, 2008 at 8:29 pm Said:

    Hi Lynn, thanks for comment. I’ll have a look at FlickrRSS 4.0 over the weekend and report back. I’m sure there will be a way to do it! Hope you have a good bank holiday (if you’re in the UK)

  3. lynn, on August 22nd, 2008 at 10:57 pm Said:

    Actually, I just figured it out. The second line of code you had was wrong in the new version:

    $url = str_replace(”_m.jpg”, “.jpg”, $imgUrlMatches[1]);

    Hope this helps someone else out.

    Cheers and enjoy the holiday :)

Leave a Reply

Worth your time...

ramblings about...

  • Work (1)
  • Play (4)
  • Life (2)
  • Web Design (5)
  • RichardTape.com (4)
  • Freebies (3)
  • Tutorials (1)

What's this?

Welcome to RichardTape.com - online home to a web designer from sunny Manchester, England.

Find out some more about me or check out what I can do for you

...popular ramblings

  • October 23, 2008 by Sticky

    WP Mag is out and it’s going to be fantastic!

  • October 15, 2008 by Sticky

    Blog Action Day - Support Poverty

  • September 19, 2008 by Sticky

    Ahoy me harties!

  • September 19, 2008 by Sticky

    Manchester Alternative Sports Day

  • September 9, 2008 by Sticky

    Where have you gone?

...loving

cd cover cd cover cd cover cd cover cd cover cd cover

...elsewhere

Morning_Zen_by_SortvindElevate_Jr_Year_3_map_by_jermilex22c4d1a145835cb41b007fb298edfcec1a851ca336b4a08a7707e2094490f81eThe_Stranger_XII_by_marccorenot_my_image

...in brief

Richard is a twenty-something year old web design ethusiast, a self-confessed geek (and proud of it) and all around nice guy. He loves skiing, well mixed cocktails and playing Ultimate Frisbee.

His friends would sum him up by saying that he is honest, a perfectionist, a pedant and occasionally cool even tho he's a geek. Richard would agree with most of that.

sitemap Sitemap css valid CSS xhtml valid XHTML Grab our RSS RSS