• Resolved voldby

    (@voldby)


    When you add a image to a post in Dashboard, you can choose to link the image to Attachment Page. I would like to do that with Feature Image but by default in the loop.

    From the WP Codex the following code link to the image – not the Attachment Page. What should I change to link to Attachment Page? I am still very much a novice in php so please be very specific ??

    <?php
     if ( has_post_thumbnail()) {
       $large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'large');
       echo '<a href="' . $large_image_url[0] . '" title="' . the_title_attribute('echo=0') . '" >';
       the_post_thumbnail('thumbnail');
       echo '</a>';
     }
     ?>
Viewing 1 replies (of 1 total)
  • Thread Starter voldby

    (@voldby)

    I have already found the solution ??

    My mistake. I had a function to much in my functions.php resulting in the Feature Image linking to the post.

Viewing 1 replies (of 1 total)
  • The topic ‘Link Featured Image to Attachment Page’ is closed to new replies.