I am trying to display a thumbnail in a foreach loop. The thumbnail is a new image size I have added called "plant-thumb". I have all the desired elements displaying properly except for the thumbnail. Here is my code:
foreach ( $posts as $post ) {
echo '<a class="modalLink" href="plant-list-accordion'.$post->ID.'" >';
echo get_the_post_thumbnail($thumbnail->ID, 'plant-thumb'); //Here is where I'm trying to output the bespoke thumbnail
echo '</a>';
$faq .= sprintf(('<div class="modal mfp-hide" id="plant-list-accordion'.$post->ID.'">%1$s<div>%2$s</div>'),
$post->post_title,
wpautop($post->post_content)
);
$faq .= '</div>'; //Close the container
}
return $faq; //Return the HTML.
};