How to make Featured Image Clickable to Attachment Page

Hello. As I run a news aggregator, I tend to use small images in our article pages to make reading and consuming content nice and quick, however some users have asked me recently if they can view the featured image in full size.

I'd like to make use of the Attachment page and name our images accordingly from now on so they have a dedicated page and the full sized image available for people to view.

I have applied the following code where the Featured image appears:

<?php if( has_post_thumbnail() ) : ?>
<a href="<?php echo get_attachment_link( get_post_thumbnail_id() ); ?>">
    <?php the_post_thumbnail(); ?>
</a>
<?php endif; ?>

This seems to apply a clickable link, but it appears to refresh the page I am on, rather than go to the attachment page.

Is there a conflict I am missing?

An example can be viewed on any of our articles at http://searchbuzz.co

:slight_smile: