我试图在foreach循环中显示缩略图。缩略图是我添加的新图像大小,称为“植物拇指”。我有所有需要的元素显示正确,除了缩略图。这是我的代码:
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.
};