WordPress.org

Support

Support » How-To and Troubleshooting » Images don’t retain links when used in gallery

Images don’t retain links when used in gallery

  • Brain trust,

    When I upload (using core image uploader) multiple pictures and insert into gallery post everything works perfectly.

    What I want to do is, upload multiple pictures…but have them link to other websites or pages. I still want the ease of the core gallery, but need the ability to link pictures elsewhere. Much like a TGP.

    I tried to give each picture it’s own link, but when it’s inserted into the post as a ‘gallery’ it looses that functionality.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Edit media.php in the wp-includes directory.

    The line number 394 is as follows in 2.6:

    $link = wp_get_attachment_link($id, $size, true);

    change it to:

    $link = wp_get_attachment_link($id, $size, false);

    and it should work! Let me know if that worked for you.

    It does work! THANK YOU!

    It was on line 450.

    Is there anyway to make the link open in a new window? 😀

    Are you just linking directly to the image or or an actual HTML file?

    Hmm, this didn’t seem to work for me. I’m trying to link to an external URL and it continues to actually save the link to the file every time, no matter how many times I go back and re-save it.

    The same problem (2.6) 🙁

    When I do do this

    $link = wp_get_attachment_link($id, $size, true);
    
        change it to:
    
        $link = wp_get_attachment_link($id, $size, false);

    It makes my thumbs in the post go to .jpg files instead of the post page.

    I want to insert [gallery] but have thumbs go to the page with the pic on it (which is a medium size picture), and when you click the med picture I want it to go to the URL I specified. Anybody figure this out yet? I am using Version 2.6.2

    I’m also having this problem in WP 2.7 the new line looks like this
    $link = isset($attr[‘link’]) && ‘file’ == $attr[‘link’] ? wp_get_attachment_link($id, $size, true, false) : wp_get_attachment_link($id, $size, false, false);

    I changed it to :

    $link = isset($attr[‘link’]) && ‘file’ == $attr[‘link’] ? wp_get_attachment_link($id, $size, false, false) : wp_get_attachment_link($id, $size, false, false);

    but still no luck. WP won’t save the link I set for the image..

    Any thoughts on this? Alternate solutons?

    Scott

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Images don’t retain links when used in gallery’ is closed to new replies.
Skip to toolbar