在wordpress网站上,我正在使用sharethis插件...
http://support.sharethis.com/customer/portal/articles/446440-wordpress-integration
FB分享链接按钮不能在facebook上获取和显示帖子描述和图像。
有什么想法/提示可能是错误的吗?
发布于 2012-11-05 15:32:19
请将此函数添加到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-04 21:39:06
如果你还没有实现Open Graph Meta标签,你可能想尝试一下--如果不能自动解析,它会给Facebook的服务器提示你想要显示什么内容。
这里的信息:http://davidwalsh.name/facebook-meta-tags
https://stackoverflow.com/questions/13218999
复制相似问题