• Hi everyone,

    I’m running 2.5.1 and have created a new website for flight simulation screenshots. My question is that each post has a collection of thumbs (check below).

    Individual post

    Each thumb within the post links through to the attachment which is the full size of the image contained within the template (check link below).

    Attachment picture

    Since this attachment page displays the full size image I have no need for the image to hyperlink to the raw image file.

    Where is the option to stop the attachment generating a link?

    I’ve looked inside post_template.php and saw function prepend_attachment($content). Within this is wp_get_attachment_link(0, ‘medium’, false); but the problem is any documentation regarding this doesn’t cover the new 2.5.* version and there’s been a change in the code regarding this function.

    Any help would be appreciated!

    Thanks,
    Ed.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter ed73

    (@ed73)

    A quick update.

    Changing:

    wp_get_attachment_link(0, 'medium', false);

    to:

    wp_get_attachment_link(0, 'medium', true);

    changes the link url from the raw file to the permalink of the attachment which is an improvement but I’d still like to remove the link altogether.

    I’m assuming the clue is in the function name wp_get_attachment_link and that there is some alternative function that will achieve my goal but documentation regarding this is thin on the ground.

    Thanks for reading and any help appreciated.

    How does one give a rel=”shadowbox” class to wp_get_attachment_link?

    Need to know that aswell, and possible how to link to something els than the raw file instead.

    You could try:
    echo '<img src="' . wp_get_attachment_url($attachment->ID) . '"/>';

    Why are there 3 functions for doing basically the same thing???

    the_attachment_link
    get_the_attachment_link
    wp_get_attachment_url

    I don’t know if you were still looking for this, but I needed it too. Check here:

    https://codex.www.ads-software.com/Function_Reference/wp_get_attachment_image

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How do you show an attachment without linking to the raw file’ is closed to new replies.