Replace this line
<?php the_post_thumbnail(); ?>
with
<?php
echo '<a href="' . get_permalink() . '">';
the_post_thumbnail();
echo '</a>';
?>
You want to use get_permalink() to turn that image into a link.
Replace this line
<?php the_post_thumbnail(); ?>
with
<?php
echo '<a href="' . get_permalink() . '">';
the_post_thumbnail();
echo '</a>';
?>
You want to use get_permalink() to turn that image into a link.