I’d like to wrap my post thumbnail with <figure>
tags.
I have tried the following and the image appears, but the <figure>
tags come up empty.
<?php
if ( has_post_thumbnail() ) {
echo '<figure>'.the_post_thumbnail('gallery').'</figure>';
}
?>
I’ve also tried the following, but the image is missing and only the empty <figure>
tags appear.
<?php
if ( has_post_thumbnail() ) {
echo '<figure>'.get_the_post_thumbnail('gallery').'</figure>';
}
?>
UPDATE
For anyone wanting the full code from the answer, here it is:
<?php
if ( has_post_thumbnail() ) {
echo '<figure>'.get_the_post_thumbnail( $page->ID, 'gallery').'</figure>';
}
?>