您需要通过阅读文档来了解这些概念的工作原理
- 用户在应用程序中执行操作,例如阅读文章
 
- 应用程序调用到 Graph API 端点 /me/action:object=Object_URL 的 HTTP POST
 
- Facebook 将抓取对象网页(您的 WordPress 页面),读取其元标记并通过操作将对象连接到用户。
 
您的操作是 news.reads,因此您可以按如下方式调用
POST https://graph.facebook.com/me/news.reads?article=[article object URL in your Wordpress Blog]
为了完成这项工作,您需要read在应用设置中设置内置操作类型:https://developers.facebook.com/apps/YOUR_APP_ID/opengraph

然后您必须具有article对象集的类型。

然后您必须在您的 WordPress 博客上设置一个对象 url,这些是通过插入元标记来完成的
<html>
    <head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# 
                  article: http://ogp.me/ns/article#">
     <meta property="fb:app_id"               content="YOUR_APP_ID"> 
     <meta property="og:type"                 content="article"> 
     <meta property="og:url"                  content="URL of this object">
     <meta property="og:site_name"            content="Name of site hosting article">
     <meta property="og:image"                content="URL to an image">
     <meta property="og:title"                content="Name of article">
     <meta property="og:description"          content="Description of object"> 
     <meta property="article:published_time"  content="DateTime"> 
     <meta property="article:modified_time"   content="DateTime"> 
     <meta property="article:expiration_time" content="DateTime">
     <meta property="article:author"          content="URL to Author object">
     <meta property="article:section"         content="Section of article">
     <meta property="article:tag"             content="Keyword">
    </head>
<body>
    <!-- main article body -->
</body>
</html>
因此,您可以根据主题设置将它们放在 header.php 或 index.php 文件中。然后您必须根据您的主题设置插入函数和 if 语句,例如
帖子的网址
<meta property="og:url" content="<?php the_permalink() ?>"/>
单个帖子标题
<meta property="og:title" content="<?php single_post_title(''); ?>" />
然后你需要 lint 这个 url 以确保你已经正确设置,你可以通过
http://developers.facebook.com/tools/debug
一旦您确定元标记设置正确,您需要测试前面提到的操作
POST https://graph.facebook.com/me/news.reads?article=[article object URL in your Wordpress Blog]
如果一切都设置好了,这应该返回操作的 id。
然后你必须使用 JS SDK 实现认证逻辑
<div id="fb-root"></div>
  <script>
    window.fbAsyncInit = function() {
      FB.init({
        appId      : '[YOUR_APP_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 show-faces="true" width="200" max-rows="1" scope="publish_actions">
  </fb:login-button>
在 functions.php 文件中或直接在 single.php 和 index.php 页面中
从那里您必须创建一个函数来在页面加载时调用以下操作
<script type="text/javascript">
  function readArticle()
  {
      FB.api(
        '/me/news.reads',
        'post',
        { article: 'http://yourwordpress.com/site/' },
        function(response) {
           if (!response || response.error) {
              alert('Error occured');
           } else {
              alert('Article read was successful! Action ID: ' + response.id);
           }
        });
  }
  </script>