How do I remove a facebook comment warning?

微笑、不失礼 提交于 2019-12-01 22:51:14
Gil Goldshlager

I wrote a complete tutorial with a small use of JS to solve this issue. Visit the tutorial


What I did was:

  • Set off the parse for XFBML tags in the JS SDK
  • Adding a function-call to the JS SDK with a date parameter that you manually set it once with a date that posts published after that date will start using the 'href' version, and posts published until that date will use the migrated version.
  • Adding another attribute to the fb:comments tag which is 'data-date' and in it's value you place your post date (dynamic code).
  • Calculating the dates in a JS code, and base on the result it's removing the not wanted attributes, and finally then it's render the XFBML tags using FB.XFBML.parse

Instead of <fb:comments ..., I used <div class="fb-comments" ... and then everything worked correctly.

https://developers.facebook.com/docs/reference/plugins/comments/

Put your website URL, set the number of posts that you want to have in comments, get the code. First part put it in header, right after <body> and the <div> in single.php (single post template). Delete </div><?php comments_template(); ?></div> and add the one from facebook ;) Works perfect for me ;)

@gil-goldshlager, thanks for this workaround, I think a lot of developers are looking for this. I myself are struggling with this since a long time on one of my sites: sharemovi.es

I think most important thing you managed is to show old vs new comments side by side.

Unfortunately the yellow box still shows up in some instances, and some comments get lost consequently :

  1. OK: post after 12.15.2011 without comments (http://sharemovi.es/theprestige)

  2. OK: both post + comments after 12.15.2011 (http://sharemovi.es/biutiful)

  3. OK: both post + comments before 12.15.2011 (http://sharemovi.es/thesocialnetwork, http://sharemovi.es/battlelosangeles and http://sharemovi.es/thequickandthedead) - really nice to see those comments back!

  4. not OK: posts before 12.15.2011 without comments - 2 problems here:

a. yellow box with "Warning: this comments plugin is operating in compatibility mode, but has no posts yet. Consider specifying an explicit 'href' as suggested in the comments plugin documentation to take advantage of all plugin features."

b. the comments for those posts/pages that were made AFTER 12.15.2011 disappear (without comments: http://sharemovi.es/fromdusktilldawn, http://sharemovi.es/waiting, with comments - I checked moderation panel - http://sharemovi.es/ellesappelaitsarah and http://sharemovi.es/thegame )

All together, I get more comments now than before, so thanks again. However the yellow box is quite ugly, doesn't look professional. Very bad design decision from Facebook!

Hopefully you can look into this, I am happy to assist where possible.

Cheers Bob

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!