开发者

Comment not appearing in Comments plugin

Having some trouble getting the link back to the page from a posted FB Comment plugin to work. Here is my situation:

  1. Setup Comments plugin using HTML5 code snippet provided by FB.
  2. Page renders correctly with FB Comments plugin showing.
  3. I'm able to successfully post a comment using the plugin.
  4. The submitted comment properly displays on my FB Wall. However, when I click on the link to be taken to the commented article I am led to the page properly, but my FB comment is missing from the plugin section.

In other words, if I go to a URL like below I can post my FB comment and refresh the page and the comment appears:

http://www.foo.com/bar/

However, when clicking on the post from my FB Wall I am led to a URL like below which shows the plugin area with no posts:

http://www.foo.com/bar/?fb_comment_id=fbc_10150317957204611_18871330_10150317957674611#f14f0016ac

My code snippet for the page with 开发者_如何转开发the plugin looks something like this:

<div id="fb-root"></div>
<script>(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/en_US/all.js#xfbml=1";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div class="fb-comments" data-href="http://www.foo.com/bar/" data-num-posts="2" data-width="668" style="margin-top: 10px;"></div>


The problem might be on how you get the url you feed fb-comments (http://foo.com/bar/) DO NOT use data-href="< ?php echo $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; ?> to get the url. For some reason Facebook's new comment id parameter doesn't work with that.

If you get the url from a local function such as data-href="<?php echo get_post_permalink() ?>" it works! And when you click the post from FB wall, it takes you to that exact comment

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜