Random Flickr Favorites 2

The Random Flickr Favorites 2 plugin allows you to access photos you like without having to purchase them. How does this work? Well, you download the plugin, re-upload it to your plugins folder, and then activate it within your plugins tab in your Wordpress. Now, if you haven’t already, get an account with Flickr. You can add as many photos as you like to your favorites. Do it. Kepeep within a theme that you like. I have chosen all computers and computer workspaces as my theme. I saved around 70 photos in my favorites.

In your Wordpress, hit the tab for options and then Random Flickr Favorites. You will need to enter the URL for your favorites (or someone else’s if you’d like). It looks like this:

http://www.flickr.com/photos/7248262@N07/favorites/

I chose the medium image size and added this:

<center><p><img src="%%image_url" width="190" alt="%%artist"/></center>

<p>I did not take this photo. <a href="%%image_page_url" rel="nofollow" alt="%%artist">"%%artist"</a> did. It is displayed using the<a href="http://clearcutblogging.com/wordpress-plugins/random-flickr-favorites-2/67"> Random Flickr Photo 2 Plugin</a> for Wordpress ;)</p>

into the template area. You can change that as you see fit. If you noticed, I added a nofollow to the tag. Maybe that is not nice, but I am anticipating making a lot of link worthy friends and I don’t want to have too many “follow” outgoing links later as the result of a plugin that makes lots of links that I forgot about. One thing you should always do is leave the link to the source of the picture.

Now, you have to put this code: <?php if (function_exists('RandomFlickrFav')) { RandomFlickrFav(); }?> into a php executable widget, or somewhere in your theme. I chose to put it in my posts. And I made a CSS div for it, so it can stand apart from the post a bit. I will still work on this.

Issues:

A: If the post is very short, the photo, blurb, and Google Adsense advertisement (that is covered in the next post) are still long. They will stretch until they hit the comment box in my theme.

B: If their is long string of letters connected together, like a URL for example, it will push that to the bottom and continue from there (causing a blank area form the last sentence before the long line of letters to the actual letters that have been pushed down).

So you are asking… Where do I put the code? ok. Your single.php file is where the content that shows up when someone clicks on a post comes from (the format anyway). Open it up in a text editor, and find these lines (or something like them for the content of the post and the div):

<div class="PostContent">

<?php the_content('Read the rest of this entry &raquo;'); ?>

Between the two, insert these:

<div class="flickrphoto">
<?php if (function_exists('RandomFlickrFav')) {
RandomFlickrFav();
}?>

</div>

Now, in your style.css file, open it in your text editor and add this:

.flickrphoto{
border: 1px solid black;
background: white;
width: 190px;
float: right;
margin: 8px 8px 8px 8px;
padding: 5px 5px 5px 5px;
}

Of course, you will probably want to adjust the width, the background color, and the border color to suit your theme. After you get it all set up, you should see a nice random picture from your Flickr favorites displaying into your posts.

To see this in action, click any post on this site. You will notice it isn’t on the homepage. I just don’t want it there. If you do, add the same code to your index.php in the corresponding place.

Download the Random Flickr Favorites 2 plugin here

If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.

Comments

[...] John’s clearcutblogging.com with an interresting article about including this plugin per post [...]

Leave a comment

(required)

(required)