1

我一直在不知疲倦地工作八個多小時,試圖用一種方式來設置我的Wordpress博客的格式,這意味着用戶可以通過使用文章的Open Graph設置來單擊按鈕並將文章發佈到股票行情。如何使用Open Graph發佈文章到時間軸?

我一直在使用教程發現here

不幸的是,我無法完成它,因爲每次點擊我創建的「發佈」按鈕時,都會彈出一條錯誤消息。

當使用Facebook的調試器時,我看不出任何問題,並且所有必要的標籤都已到位(我有一個插件可以幫我完成,這非常完美)。

下面是我對我的header.php文件提出以配合本教程的改變:

<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US" 
     xmlns:fb="https://www.facebook.com/2008/fbml"> 

添加了以下之前</head>

<script type="text/javascript"> 
    function postArticle() 
    { 
     FB.api(
     '/me/[NAMESPACE]:read?Article=<?php get_permalink() ?>', 
     'post', 
     function(response) { 
      if (!response || response.error) { 
       alert('Error occured'); 
      } else { 
       alert('Successful! Action ID: ' + response.id); 
      } 
     }); 
    } 
    </script> 

放置清晰登錄按鈕,詢問許可:

<div id="fb-root"></div> 
    <script> 
    window.fbAsyncInit = function() { 
     FB.init({ 
     appId  : '[APPLICATION ID]', // App ID 
     status  : true, // check login status 
     cookie  : true, // enable cookies to allow the server to access the session 
     xfbml  : true // parse XFBML 
     }); 
    }; 

    // Load the SDK Asynchronously 
    (function(d){ 
     var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;} 
     js = d.createElement('script'); js.id = id; js.async = true; 
     js.src = "//connect.facebook.net/en_US/all.js"; 
     d.getElementsByTagName('head')[0].appendChild(js); 
    }(document)); 
    </script> 

    <fb:login-button perms="email,publish_actions,user_actions.news"> 
    Login with Facebook 
    </fb:login-button> 

最後,放置在那裏我希望按鈕出現在網頁上點以下幾點:

<fb:add-to-timeline></fb:add-to-timeline> 
<form> 
<input type="button" value="Publish" onclick="postArticle()" /> 
</form> 

在我的Open Graph的設置,我有動作類型「讀」,以及對象類型「文章」。

這是怎麼來的不適合我?

回答

1

它對我的作品,低谷tutorial

你加opengraph標籤在你的頭上節,如..

<head prefix="og: http://ogp.me/ns# [YOUR_APP_NAMESPACE]: 
        http://ogp.me/ns/apps/[YOUR_APP_NAMESPACE]#"> 
    <title>OG Tutorial App</title> 
    <meta property="fb:app_id" content="[YOUR_APP_ID]" /> 
    <meta property="og:type" content="[YOUR_APP_NAMESPACE]:recipe" /> 
    <meta property="og:title" content="[YOUR_TITLEIts]" /> 
    <meta property="og:image" content="http://fbwerks.com:8000/zhen/cookie.jpg" /> 
    <meta property="og:description" content="The Turducken of Cookies" /> 
    <meta property="og:url" content="http://fbwerks.com:8000/zhen/cookie.html"> 
</head> 

New things about og:article

+0

「使用Facebook的調試我看不出有什麼問題和所有必要的標籤都已到位(我有一個插件可以幫我實現,這非常完美)「。 – Ben 2012-03-01 13:48:29

+0

如果用戶添加到他的時間表之前,當suer閱讀文章並測試之前,您是否知道自動執行postArticle()的人? 謝謝 – superscral 2012-03-16 10:31:58

相關問題