Making images from single.php pointing to an attachment .php template
If I understand you correctly, you need to link your images not to the file, but to the attachment template (attachment.php). If so, then try the following code in your single.php: <?php if( has_post_thumbnail() ) { $attachment_page_url=””; $attachment_page_url = get_attachment_link( get_post_thumbnail_id() ); ?> <a href=”<?php echo $attachment_page_url; ?>” class=”featured-image”> <?php the_post_thumbnail(); ?> </a> <?php } … Read more