Modding flickrRSS plugin

I have a Flickr account, like many of you and I found that flickRSS plugin is the best solution for displaying your photos in your Wordpress powered web site.

The only thing that I was missing was the option to display the photo title, so I’ve modified the plugin file to display the title below the photo. You can see the result at the top of the home page.

The plugin mod is quite simple, so if you want do to this just open the flickrRSS.php file inside your wp-plugin folder (backup it first!) and go to line 100.

You’ll find this:

} // end file check
# use cached image
print $before_image . "<a href=\"$url\" title=\"$title\">
<img src=\"$cachePath$flickrSlug.jpg\" alt=\"$title\" /></a>".$after_image;
} else {
# grab image direct from flickr
print $before_image . "<a href=\"$url\" title=\"$title\">
<img src=\"$imgurl\" alt=\"$title\" /></a>".$after_image;
} // end use imageCache

Now modify line 100 and 103 adding this

"<div class=\"flickrimgdesc\">".$title."</div>"

before

.$after_image;

Obviously you can change flickrimgdesc using the class name you prefer.

This is the final code:

} // end file check
# use cached image
print $before_image . "<a href=\"$url\" title=\"$title\">
<img src=\"$cachePath$flickrSlug.jpg\" alt=\"$title\" /></a>".
"<div class=\"flickrimgdesc\">".$title."</div>".$after_image;
} else {
# grab image direct from flickr
print $before_image . "<a href=\"$url\" title=\"$title\">
<img src=\"$imgurl\" alt=\"$title\" /></a>"."
<div class=\"flickrimgdesc\">".$title."</div>".$after_image;
} // end use imageCache

Now you’ll see the photo title below every photo. If you want you can give it some style, like I did:

.flickrimg {
background:#000000;
float:left;
margin:0 20px 20px 0;
padding:15px 15px 7px 15px;
}

.flickrimg img {
border:1px solid #FFFFFF;
}

.flickrimgdesc {
color:#FFFFFF;
font-family: verdana,arial,helvetica,sans-serif;
font-size:11px;
font-weight:bold;
margin-top:5px;
}

2 commenti

  1. Pubblicato 29 Giugno 2008 alle 20:27 | Permalink

    Hi, thank you for the great information on how to modify flickrss. Can you please tell me on what line to insert the code to add style to the images? I am not very good with code. I am using version 4.0 of flickrrss. Thanks!

  2. Alessandro
    Pubblicato 1 Luglio 2008 alle 08:26 | Permalink

    Hi Karl,

    style properties sould be added to your theme’s style sheet. It’s the style.css inside your theme folder.

Scrivi un commento

La tua e-mail non sarĂ  mai pubblicata o ceduta ad altri. I campi obbligatori sono contrassegnati con un *

*
*