问题
my fb comments code is:
<fb:comments url="<?=$this_url?>" width="600" xid="<?=$this_unique_xid?>" notify="true" candelete="true" simple="1" numposts=1 url="http://www.veethi.com"></fb:comments>
Now if i want to remove the warning message:
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
I need to replace "url" to "href", but by doing this i lose my old comments, Is anyone who facing the problem or solution pls, reply me. I need one solution that remove the warning message and the same way i have all my old comments. thankx in advance.
回答1:
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
回答2:
Instead of <fb:comments ...
, I used <div class="fb-comments" ...
and then everything worked correctly.
回答3:
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 ;)
回答4:
@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 :
OK: post after 12.15.2011 without comments (http://sharemovi.es/theprestige)
OK: both post + comments after 12.15.2011 (http://sharemovi.es/biutiful)
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!
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
来源:https://stackoverflow.com/questions/8487357/how-do-i-remove-a-facebook-comment-warning