事实上,我在这个网站上搜索这个问题的答案已经有一段时间了。正在寻找一种为facebook“回显/打印”多个og:Image的方法。我在这里只使用了“the\\u post\\u缩略图”
function fb_image() {
if (is_single()) {
global $post;
$feature_image = get_the_post_thumbnail($post->ID);
$doc = new DOMDocument();
$doc->loadHTML($feature_image);
$imageTags = $doc->getElementsByTagName(\'img\');
foreach($imageTags as $tag) {
$image_url = $tag->getAttribute(\'src\');
}
}
?>
<meta property="og:image" content="<?php echo $image_url; ?>" />
<?php }
add_action(\'wp_head\', \'fb_image\');