0

在 wordpress 网站上,我正在使用 sharethis 插件...

http://support.sharethis.com/customer/portal/articles/446440-wordpress-integration

FB Share Link Button 不获取并在 facebook 上显示帖子描述和图像的地方。

任何想法/提示可能有什么问题?

4

2 回答 2

2

请将此函数添加到您的functions.php 文件中。

function wpc_fb_opengraph() {
$wpc_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'large');
?>
<meta property="og:title" content="<?php the_title(); ?>" />
<meta property="og:url" content="<?php the_permalink(); ?>" />
<meta property="og:site_name" content="<?php bloginfo('name'); ?>" />
<meta property="og:description" content="<?php echo strip_tags(get_the_excerpt($post->ID)); ?>" />
<meta property="fb:app_id" content="APP ID HERE">
<meta property="fb:admins" content="YOUR FB USER ID (OR USERNAME) HERE"/>
<meta property="og:image" content="<?php echo $wpc_image_url[0] ?>"/>
<?php }

add_action('wp_head', 'wpc_fb_opengraph');

注意:如果您的网页还没有任何 facebook 应用程序,则不必使用此行。

<meta property="fb:app_id" content="APP ID HERE">
<meta property="fb:admins" content="YOUR FB USER ID (OR USERNAME) HERE"/>

快乐的WordPress..

于 2012-11-05T07:32:18.500 回答
0

如果您还没有,您可能想尝试实现 Open Graph Meta Tags - 如果无法自动解析,它将向 Facebook 的服务器提示您想要显示的内容。

这里的信息:http: //davidwalsh.name/facebook-meta-tags

于 2012-11-04T13:39:05.847 回答