Facebook分享没有在wordpress中获取图像

时间:2012-03-20 07:20:07

标签: facebook wordpress wordpress-plugin wordpress-theming

wordpress的一个小问题:

  1. og:的少数元标记在页面
  2. 上重复两次
  3. 在脸书图片上分享现在在facebook分享中显示..
  4. 如果有人可以帮忙请回复

1 个答案:

答案 0 :(得分:0)

在主题中使用要素图像

function ST4FB_header() {
    global $post;
    $post_description = ST4_get_FB_description($post);
    $post_featured_image = ST4_get_FB_image($post->ID);
    if ( (is_single()) AND ($post_featured_image) AND ($post_description) ) {
?>
  <meta name="title" content="<?php echo $post->post_title; ?>" />
  <meta name="description" content="<?php echo $post_description; ?>" />
  <link rel="image_src" href="<?php echo $post_featured_image; ?>" />
<?php
    }
}
add_action('wp_head', 'ST4FB_header');  

并编写此函数以获取更多信息http://wp.tutsplus.com/tutorials/creative-coding/share-your-posts-on-facebook-with-a-preview-image-and-a-description/