WordPress.org

Ready to get started?Download WordPress

Forums

Images don't retain links when used in gallery (8 posts)

  1. Greg Rickaby
    Member
    Posted 6 years ago #

    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.

  2. maxdefcon
    Member
    Posted 6 years ago #

    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.

  3. Greg Rickaby
    Member
    Posted 6 years ago #

    It does work! THANK YOU!

    It was on line 450.

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

  4. maxdefcon
    Member
    Posted 6 years ago #

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

  5. ericaustinlee
    Member
    Posted 5 years ago #

    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.

  6. Jakub_mt
    Member
    Posted 5 years ago #

    The same problem (2.6) :(

  7. gijoner
    Member
    Posted 5 years ago #

    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

  8. vsellis
    Member
    Posted 5 years ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags