有谁知道如何创建Facebook分享按钮?我需要它是大约15-20像素高的水平版本。他们似乎已经放弃了任何赞成类似按钮的文档,但我希望两者都可以。我似乎只能找到wordpress插件,但我只需要代码片段。Facebook分享按钮代码片段
任何帮助,将不胜感激...三江源
格林 劳卡服装
有谁知道如何创建Facebook分享按钮?我需要它是大约15-20像素高的水平版本。他们似乎已经放弃了任何赞成类似按钮的文档,但我希望两者都可以。我似乎只能找到wordpress插件,但我只需要代码片段。Facebook分享按钮代码片段
任何帮助,将不胜感激...三江源
格林 劳卡服装
,如果你想使用JavaScript SDK做到这一点:
window.fbAsyncInit = function() {
FB.init({ appId: appId, status: true, cookie: true,
xfbml: true
});
};
(function() {
var e = document.createElement('script');
e.async = true;
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
$("#Pst").click(function shareWithFacebook() {
FB.ui({ method: 'stream.publish',
message: 'message',
user_message_prompt: 'message',
attachment: {
name: 'message',
caption: 'message',
description: ('message'),
href: 'http://www.destination360.com/europe/sweden/images/s/sweden-visby.jpg',
media: [{ 'type': 'image', 'src': 'http://www.destination360.com/europe/sweden/images/s/sweden-visby.jpg', 'href': 'http://www.destination360.com/europe/sweden/images/s/sweden-visby.jpg'}]
},
action_links: [{ text: ' Name ', href: 'http://www.destination360.com/europe/sweden/images/s/sweden-visby.jpg'}]
},
function (response) {
if (response && response.post_id) {
// Do some custom action after the user successfully
// posts this to their wall
alert('Thanks for sharing!');
}
}
);
return false;
});
<div id="fb-root">
</div>
<a href="#" id="Pst" onclick="return shareWithFacebook();" >
Share
</a>
,如果你想使用插件来做到这一点并请你把它标记为回答:): http://developers.facebook.com/docs/reference/plugins/like/
你会发现代码l IKE说:
<div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=137344766349901&xfbml=1"></script><fb:like href="www.eslamsoliman.uk.cm" send="true" width="450" show_faces="true" font=""></fb:like>
改变你的链接:)
的分享按钮已被弃用,尽管仍然正常工作。 目前推荐的实现从网站共享的方式是通过Like button或Send button(它通常也与Like按钮配对,但独立工作)。
如果必须使用旧共享按钮,出于某种原因,该文件是在开发者网站不再可用,但这里有一个第三方例如:http://www.wpcode.net/add-share-button.html/
(它应该在任何网站,而不仅仅是WordPress的博客工作)