Adding Links To WP Post Thumbnail Plugin

Every professional blog must have thumbnails to identify every post. This not only enhances the overall design of the blog, but also adds to the vibrance of the site. It also leverages slightly from the search engine optimization (SEO) perspective.

My blog pages were literally looking visually tasteless and I recently installed the WP Post Thumbnail plugin to fix this. This plugin worked out-of-the-box and allowed me to easily include thumbnails to my posts without performing a large number of manual steps. Simple: upload image, crop and save thumbnail!

However, then I observed that people would have a natural tendency to click the thumbnail to open the post. To my surprise, this plugin had no configuration page. Ultimately, I had to edit the plugin itself to fix this.

The code to do this is really simple. Go to “Editor” under Appearance tab of your WordPress admin section and start editing “wp-post-thumbnail/wppt.php”. Go to line 277 (that says $content = <img alt=”” …) and replace the entire line with the following line of code:

$content = '<a href="'.get_permalink($post->ID).'"><img src="'. $src .'" alt="'.$alt.'" /></a>' . $content;

This is applicable for the plugin version 0.1.8. Previous or latter version may have this code in some other line. In fact, as I write there is an updated beta version available for download.

I think that the author, Stanley Yeoh has done a great job with this plugin. I hope he provides this feature, of being able to link the thumbnails, in his upcoming release.

Stlease.anley Yeoh

5 Replies to “Adding Links To WP Post Thumbnail Plugin”

  1. Not only did I find the plugin, but also the most important fix to it! Thanks dude. High time I learn a bit of coding. 😛

  2. Hey Shamasis,
    This is exactly what i was looking for! Thankx for this…

    I also have another request. Have u tried the WP Post Thumbnail 0.2 Beta 2 on wordpress 2.8.2?
    I am getting a warning:
    Invalid argument supplied for foreach() in /home7/adzguruc/public_html/ on line 774

    And i can’t see the loaded image to crop…
    If there is a solution please help me with it…

    I have tried mailing Stanley twice with no response…

  3. Ya the plugin isn’t working on the newest WP 2.8.4 either. I am able to chose a thumbnail fine, crop it and save it, but then it never sends the image b/c the thumbnail area just has a question mark/blank area.
    I could not get a response from Stanley either and their is no support. I know all I would need is to edit the php somewhere, but I have no idea how to do that.
    Any suggestions?

    1. I am sorry for the late reply, but I have not yet deployed the BETA plugins on my (this) website. I generally do not put in BETA codes lest the screw up 😛

      However, I have a few suggestion: (1) WP-Post-Thumbnail (last stable version,) worked well only on FireFox. It did not work well on Chrome and IE7+. I have not tested in Safari. (2) Why don’t you downgrade to version stable 0.1.8? It works fine with WordPress 1.8.4

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.