準備工作:
(1)取得程式碼
首先進入 FB 讚按鈕的官網:
用途:「讚按鈕」安裝程式碼
網址:https://developers.facebook.com/docs/plugins/like-button?locale=zh_TW
FBˇ的讚 與留言板 取得方法都是相同
請貼至記事本上 並將 在這裡輸入APP ID 換成你的 APP ID
(2)拿到App ID和管理者ID後接下來就要開始來安裝Facebook留言了~
↑ 到部落格後抬選「範本」--> 「編輯HTML」
找到<head>,並在<head>的下面貼上以下的程式碼!
在這裡輸入管理者ID --> 改成你的管理者ID
在這裡輸入App ID --> 改成你的App ID
<meta content='在這裡輸入管理者ID' property='fb:admins'/>
<meta content='在這裡輸入App ID' property='fb:app_id'/>
(3)接下來安裝JavaScript SDK,找出</body>,在</body>的上面貼上以下程式碼!
記得把 在這裡輸入App ID --> 改成你的App ID
<!-- Facebook JavaScript SDK 開始 --><div id='fb-root'/>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '在這裡輸入App ID',
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
FB.Event.subscribe('xfbml.render', function(response) {
});
FB.Event.subscribe('auth.sessionChange', function(response) {
//
});
FB.Event.subscribe('edge.create', function(response) {
//
});
FB.Event.subscribe('comments.create', function(response) {
//
});
};
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/zh_TW/all.js#appId=在這裡輸入App ID&xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script><!-- Facebook JavaScript SDK 結束 -->
(4)找出 <b:includable id='comments' var='post'>,在<b:includable id='comments' var='post'>下面貼上以下程式碼!
沒有留言:
張貼留言