Last week Facebook made a few major announcements and introduced a few new features among which the Like-button. If you’re a Facebook user yourself you’re probably already familiar with this: whenever somebody posts something on Facebook you can click the Like-button to express that you’re supporting whatever this person just posted.
But with last week’s update, Facebook extended the use of this button to be used on any website now. By integrating this feature into your website, visitors can Like whatever they see by clicking on the Like button on that site. By doing so, their friends on Facebook will see that this visitor liked a certain website and now they can click on that link to see if they agree.
Let’s put this in clear benefit for site owners: everybody can share your website with all their friends with only one click of the mouse!
You don’t even need to have a Facebook account yourself to make use of this tool. Just install the code (just one line) on your website and your visitors can start spreading the link. The following line of code is all you need:
<iframe src="http://www.facebook.com/widgets/like.php?href=http://www.studiostacks.ie" scrolling="no" frameborder="0" style="border:none; width:450px; height:80px"></iframe>
Use the Facebook API in WordPress
If you want to use the Facebook API in your WordPress template, then use the following line (remember this is for changing the WordPress template! If you’re adding the link to an individual post, then use the one above):
<iframe src="http://www.facebook.com/widgets/like.php?href=<?php the_permalink(); ?>" scrolling="no" frameborder="0" style="border:none; width:450px; height:80px"></iframe>
And that’s all there is to it. See the blue button that says Like just below this article to see the new Facebook API in action.