Adding Twitter and Facebook widgets in your site

It’s been some time since I last updated my blog, what with all the exams and me working on a dozen projects simultaneously. However, I’d like to take the time to make a small blog post on how to add twitter and facebook buttons on your blog/site.

Twitter is pretty straightforward. You can add a follow button on your page by just adding this little snippet of code.

<iframe style="width: 300px; height: 20px;" src="//platform.twitter.com/widgets/follow_button.html?screen_name=twitterapi" frameborder="0" scrolling="no" width="320" height="240"></iframe>

Now, just replace twitterapi with your account and you’re done :)

As far as facebook goes, you will probably want to add a ‘Like’ button in your website. Facebook provides a page which allows you to design it to fit your needs, which you can find here. You can also get some sample code for a plain Like button bellow.

<iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fcodebender.cc&amp;send=false&amp;layout=button_count&amp;width=250&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;height=21&amp;appId=276306429134783" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:250px; height:21px;" allowTransparency="true"></iframe>

You can find more info on the Twitter and Facebook APIs in their respective API Documentation, here and here.

Leave a Reply


Tzikis is using WP-Gravatar