• I got my attachment.php template file going and it’s almost doing what I want, but how do I make the image NOT link to the file? I don’t at all want images outside my template.

    It might be something to do with

    php echo $attachment_link;

    ???

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter colourdreamer

    (@colourdreamer)

    This is what I tried that didn’t work. First I switched to not using month-separated files for the images.

    <img src="http://wwww.style-spotlight.net/wp-content/uploads/<?php echo basename($post->guid); ?>" alt="<?php echo basename($post->guid); ?>" />

    Don’t know why it didn’t work!! 🙁

    mikenstein

    (@mikenstein)

    I tried this and it worked.

      -go to wp includes folder

      -then open post-template.php

      -at the bottom of the file is a section marked attachments

      -you need to find the line

      $innerHTML = get_attachment_innerHTML($_post->ID,
      $fullsize, $max_dims);
      
      	return "<a href='$url'> $innerHTML </a>";

      -then take out the anchor after return so you have:

      return "$innerHTML";

    now you will be able to click on the thumbnail and have the full size image load into a page but not link to the actual file from the full size image.

    *kinda sloppy I know, but it works.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to? Attachment Image NOT link to file’ is closed to new replies.