Reputation: 3369
I have a list of links and on each individual page there's a "like" button to "like" that page. But I want a "like" button next to each link in the list which will like the URL of the link next to it (just like it would if you clicked on the link and then the "like" button).
To create the button on each individual page I use the following code:
<script>
window.fbAsyncInit = function()
{
FB.init({appId: '*****', status: true, cookie: true, xfbml: true});
};
</script>
<div class="share_button btn_fb">
<fb:like layout="button_count" font="tahoma"></fb:like>
</div>
Upvotes: 3
Views: 7006
Reputation: 12328
You can always just go to the Facebook Developers page here:
http://developers.facebook.com/docs/reference/plugins/like/
and it will generate the code for you, and you can just copy it into your site. I just re-verified it. It works nicely.
This will generate the code(or something similar) that @Coding-Freak wrote.
Upvotes: 1
Reputation: 12508
<div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:like href="[put the url here]" send="true" width="450" show_faces="true" font=""></fb:like>
Just replace the [put the url here]
with the url you want to like and then paste the full code to the place where you want the like button.
Upvotes: 1
Reputation: 926
Try the following:
<fb:like layout="button_count" href="http://yourlink.com" font="tahoma"></fb:like>
Where the href attribute is the URL you want the person to 'like'
Upvotes: 5