Facebook Comments Plugin for different articles on IP.Content - facebook

I'm trying to add facebook comments plugin to the IP.Content articles with following code
<html>
<head>
<meta property="fb:app_id" content="{YOUR_APPLICATION_ID}">
</head>
<script src="http://connect.facebook.net/en_US/all.js#xfbml=1">
</script>
<body>
<div id="fb-root"></div>
<fb:comments href="YOUR_CANONICAL_URL"></fb:comments>
</body>
</html>
Can anyone explain me what is YOUR_CANONICAL_URL ?
If I'm putting my website url , anyone who commets the article that shares the meta description of my main page on the his wall.
What link I need to insert to make displaying the link to the article on anyone who commets wall.
There was something like <?php echo rand(); ?> to be added to the link....but I'm not quite good in that php tricks....
Also I'm putting that code into global articles view template. But for that reason comments are the same for all articles. How can I make them be different for each article ?
Thank you for any replies on that subject...

I added fb comments to my website (php script/ smarty engine) and when you write a comment it's only for the page/article you are on with this code
`<div class="fb-comments" data-href="http://yourdomain/{$smarty.server.REQUEST_URI}" data-num-posts="5" data-width="550"></div>`

I don't see an href attribute in the official docs for fb:comments seen here: http://developers.facebook.com/docs/reference/fbml/comments/
To differentiate comments on different items you are supposed to use the xid attribute. This tells Facebook what "item" (page, post, product, etc) people are commenting on. The docs hint that you can use any url encoded string as an xid, so maybe you could do something like this:
function get_my_url()
{
global $HTTP_HOST;
global $REQUEST_URI;
if (!empty($_SERVER['HTTPS']))
$protocol = 'https';
else
$protocol = 'http';
return "${protocol}://${HTTP_HOST}${REQUEST_URI}";
}
$xid = urlencode(get_my_url());
?>
<fb:comments xid="<?= $xid; ?>"></fb:comments>

Related

How to update/replace Facebook Embedded posts in html?

I want to be able to update/replace embedded facebook posts in my website.
For example say i have this code (part of the codesnippet is taken from facebook here):
<html>
<title>My Website</title>
<body>
<button onclick="replacePost();">replace</button>
<script src="//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.2"async></script>
<div id="myDiv">
<div class="fb-post"
data-href="https://www.facebook.com/FacebookDevelopers/posts/1234"
data-width="500"></div>
</div>
<script>
function replacePost()
{
var newHTML = '<div class="fb-post"';
newHTML += 'data-href="https://www.facebook.com/FacebookDevelopers/posts/123"';
newHTML += 'data-width="500"></div>';
$("#myDiv").html(newHTML);
}
</script>
</body>
</html>
Here as an example, when the page loads, there is a button and then the facebook post with the id 123 will pop up as expected. And when i click the button, i use jQuery to find the parent div of the facebookpost, and replace it with some new HTML. In this case, a post with the id 1234. But the post will not pop up :-( (Hopefully, you can see what i am trying to do).
So how do i dynamically delete a post and replace it with another post?
You need to parse your html again so that the facebook sdk can fetch the new post. If you change your JavaScript to the following:
<script>
function replacePost()
{
var newHTML = '<div class="fb-post" data-href="https://www.facebook.com/20531316728/posts/10154009990506729/"data-width="500">';
$("#myDiv").html(newHTML);
FB.XFBML.parse() //<---- add this
}
</script>
Then each time you call replacePost you html will be parsed again. Instead of parsing the whole page you can parse a specific tag for the sake of efficiency:
FB.XFBML.parse(document.getElementById('foo'));
Docs here: https://developers.facebook.com/docs/reference/javascript/FB.XFBML.parse

Customizing Addthis Plugin - passing url using classic asp

I am having lots of problems while coming up with a solution.
I have a website that share text or image greetings( text greeting only at this time) on facebook or twitter etc. I planed to use Addthis.
So I created a function like this
<%
Function DisplayShareDiv(surl, sT, sSummary)
%>
<div class="addthis_toolbox addthis_default_style addthis_32x32_style"
addthis:url="<%=surl%>"
addthis:title="<%=sT %>"
id="addthis_container"
addthis:Description="<%=sSummary%>">
<a class="addthis_button_facebook"></a>
<a class="addthis_button_twitter"></a>
<a class="addthis_button_google_plusone"></a>
<a class="addthis_button_email"></a>
<a class="addthis_button_compact"></a>
<a class="addthis_counter addthis_bubble_style"></a>
</div>
<script type="text/javascript">var addthis_config = { "data_track_addressbar": true };</script>
<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=###################3"></script>
<!-- AddThis Button END -->
<%
end function
%>
Now problem is that title appears when click on facebook or twitter but url doesn't. I also want to add the description to it. I have og tags too but they need to be dynamic too and i am having problems with fb not picking up that info either. Even though i have run it through debugger. I am at it for 2 days and it is now all a mish mash. I would really appreciate if someone can please help me!!
Now I'm getting this. Is that as you require?
I think facebook was picking up an old version of your page.
The text it picked up were from the OG and description meta tags on your home page.
If you run your page through their debugging tool, that forces it to scrape the latest version of your page. Plus you might get some useful info too. https://developers.facebook.com/tools/debug/

Facebook comment into wordpress genisis

I am applying facebook comments to display on wordpress genisis theme on every post. I apply facebook comments on twentyeleven theme its work.
But failed to apply on genisis theme.
Can anyone help me how i can apply facebook comments to genisis theme .
Thanks in Advance.
f you’re using the Genesis Theme Framework you can easily add a Facebook comment box to your single posts by adding the following code to your Functions.php file.
function add_fb_comments() {
if (is_single()) { ?>
<h3>Comment With Facebook:</h3><div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
<fb:comments href="<?php the_permalink(); ?>" num_posts="20" width="600">
</fb:comments>
<?php }
}
add_action('genesis_after_post', 'add_fb_comments', '99');
Hope this will work for you.

Facebook share 'clickable' url-link issue

I have a problem with clickable url-link in Facebook.
As you can see nr 1. is not clickable but nr 2 and 3 are.
Sometimes it is clickable and other times not. (randomize)
What I want is that all the share links are not 'clickable' like nr 1.
How can I fix this? I'm stuck for several days.
My php code:
<script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script>
<li class="icon share_facebook l" id="facebookshare"><a name="fb_share" type="button" share_url="http://www.smartnet7.com/promo.php?id_promo=<?php echo $id_promo?>&username=<?php echo $username ?>"target="_blank"></a> </li>
I hope some body can help me!
The problem might be with the page that you are trying to share. As mentioned earlier in the comments above, you may check the same page's link by Facebook Linter. To achieve a uniformity you may want to include the Opengraph meta tags as recommended by Facebook http://developers.facebook.com/docs/opengraphprotocol/
In your case it looks like an issue with Facebook populating your page url so you might want to include <meta property="og:url" content="your page's complete url"/> within the <head> </head> tags in your page. Even though this url can be determined from your page alone but Facebook recommends you to include these tags to avoid any inconsistency.
May be number 1 isn't clickable as it is not a valid url(although browser should figure it out). It should have www. in the beginning

facebook xid doesn't work

i need separate comment thread for each post on my website, so i followed instructions at http://developers.facebook.com/blog/post/472, ie i inserted the code:
<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
<fb:comments href="www.mysite.com" xid="postPOST_ID_HERE"></fb:comments>
under each post.
but it doesn't work and there is SAME comments thread under each post.
if i try this code:
<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
<fb:comments href="http://www.mysite.com/news.php?id=POST_ID_HERE"></fb:comments>
it seems to work, ie i get separate comment thread per post. but according to facebook instructions href parameter needs to be canonical url. am i doing something wrong in the first case or is the second example way to go (even if against facebook manual)?
I don't think you need to use both the href and the xid variables. I think the href variable is the newer version according to Facebook Developer Blog this is the new code:
<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
<fb:comments href="YOUR_CANONICAL_URL"></fb:comments>
It also says "If you already have the original Comments Box installed, include the parameter migrated="1" to keep existing comments" and shows this as an example:
<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
<fb:comments xid="YOUR_XID" migrated="1"></fb:comments>
I am using the first version I posted here, but using addresses like you mentioned, and it works. So I'd say go with the second version even if it goes slightly against what they say. It works properly for me.
Plugin doesn't work on my 2 sites on different servers from yesterday, but on http://www.vesti.ru/doc.html?id=442871 plugin works normally