Swapped the_permalink(); to get_the_permalink( $id );