WordPress Guy

Linked Image

If, like me, you have blogs where you use to have an image at the very beginning of your posts then you should know that people expect to access your post by clicking on the image (I tested this with CrazyEgg).

That’s why I came up with the Linked Image plugin. This little plugin does just that, it takes the first image in your post and links it to the post itself. Everywhere but in the post page.

Download

Linked Image 1.0

Installation

  1. Download the plugin and expand it.
  2. Copy the ‘first-image-permalink.php’ file into your plugins folder (wp-content/plugins/).
  3. Login into the WordPress administration area and go to the Plugins page.
  4. Locate the First Image Permalink plugin and click on the activate link
  5. That’s it

Known Issues

  • The plugin doesn’t currently work if the first image is already linked and may render unexpected results.
  • Smileys get linked too

Donate

Support further plugin development by making a small donation:

donate

Comments

  • Thanks a lot for this pluging. Just downloaded, go to see how it works

    Khamosh May 8th, 2008 at 11:24 am
  • cool plugin
    it worked for me
    thanks a lot

    asian beauty talk May 8th, 2008 at 12:26 pm
  • You’re very welcome. Please do not hesitate to contact me if you have any problem at all.

    Wessley Roche May 8th, 2008 at 12:51 pm
  • hello man
    i need my link open in new windown,an ur teacher me to setup it??

    asian beauty talk May 8th, 2008 at 1:11 pm
  • @asian beauty talk: If you’re able to edit the plugin file (linked-image.php) then all you have to do is locate the part that says <a href=”‘.get_permalink().’”>$1</a> and change it for <a target=”_blank” href=”‘.get_permalink().’”>$1</a>

    Wessley Roche May 8th, 2008 at 1:18 pm
  • Excellent, tks Wessley, works out of the box!

    BangkokDan May 8th, 2008 at 2:35 pm
  • does it works for older posts too?? Or it will work only for new posts??

    Khamosh May 8th, 2008 at 3:17 pm
  • @Khamosh: Yes, it’ll work for older posts as well.

    Wessley Roche May 8th, 2008 at 3:21 pm
  • Only one question…

    If I add the image to the post trought the image uploader on WP2.5+, can the plugin retrieve the thumbnail of the image generated by the image uploader instead the image itself?

    I wanted to do this long time ago, and I don´t know that if this plugin capable of this.

    Madcore May 9th, 2008 at 2:57 am
  • Downloading. Giving it a try. A very useful plugins if it works for me ;)

    JunkieYard Dot Com May 9th, 2008 at 12:54 pm
  • Great plugin.

    youfulfill May 9th, 2008 at 11:47 pm
  • Awesome idea and great plugin! Thank you very much!

    Adrian May 10th, 2008 at 3:23 pm
  • Nice and simple.. Would make sense to implement the filter in “the_excerpt”, too. I’ve also the one problem that smiley-pictures are linked.. To avoid this you have to put something like this in the “if”:
    $content1 = preg_replace($searchfor, $replacewith, $content, 1);
    $smiley = substr_count($content1, ‘wp-smiley’);
    if (!$smiley) $content = $content1;

    Andy May 11th, 2008 at 8:44 am
  • Sorry, my code sucked ;) But when you replace the $smiley-line with
    preg_match ($searchfor , $content , $smileys);
    $smiley = substr_count($smileys[0], ‘wp-smiley’);
    it should work.. though I guess there are better ways to do this ;)

    Andy May 11th, 2008 at 9:53 am
  • @Andy: You’re right… I didn’t realize smileys would get linked as well. Thanks for the suggestions, I’ll try to fix this asap.

    Wessley Roche May 11th, 2008 at 11:11 am
  • hi. Thanks for plugin

    perfect.

    regards

    baron May 13th, 2008 at 6:55 pm
  • can u pls tell me the coding if i want to make first three images as the permalink of the article …

    thnx for a wonderful plugin

    Jaspal Singh May 18th, 2008 at 10:16 am
  • @Jaspal Singh: You would replace the “1″ in this line: “$content = preg_replace($searchfor, $replacewith, $content, 1);” for a 3. Like: “$content = preg_replace($searchfor, $replacewith, $content, 3);”

    Wessley Roche May 18th, 2008 at 10:46 am
  • Excellent idea. Do you or anybody know if it conflicts with this plugin from Justin Tadlock? -
    http://justintadlock.com/archives/2008/05/27/get-the-image-wordpress-plugin

    David@VineSites June 4th, 2008 at 7:02 am
  • this is pretty cool. Btw, can it also capture the post title to be the image caption and alt tag?

    Thanks and hope to see more improvement.

    gofree June 15th, 2008 at 3:11 pm
  • @gofree: It could. Definitely something to consider for a future version.

    Wessley Roche June 18th, 2008 at 6:56 pm

Your Comment