the_permalink()
and the_post_thumbnail()
echo their output. Use the "get_*
version of those functions, get_the_permalink()
and get_the_post_thumbnail()
when concatenating a string to be output.
Both the_post_thumbnail()
and get_the_post_thumbnail()
will echo/return <img>
tags so don’t wrap their output in an <img>
tag because it’s already taken care of by those functions.
The original HTML posted is missing quotes and I’m not sure why you have the <head>
, <style>
, and <body>
tags in there; those tags are not necessary.
This code will output a linked image:
<?php
echo '<a href="' . get_the_permalink() . '" target="_blank">' .
get_the_post_thumbnail( get_the_ID(), 'video' ) . '</a>';
?>