I love Like/Vote/Digg buttons. They are amazing when it comes to spread out your stories in social media. Since I hooked up to WordPress I’ve been experimenting with various social media plugins but none are perfect and I always keep looking for something new and better ones.
The first social bookmarking plugin, which I used to use and which lasted for quite a few years, was sociable. It was good, it was easy to use and you could select which social bookmarking icons do you want to display. However there was one problem with sociable plugin. It didn’t show count.
The next plugin which I experimented with was digg digg. It’s look was awesome. Digg Digg copied Mashable’s style to WordPress. The problem with digg digg is that it doesn’t work. It is slow, damn slow to be honest and brings down your blog. So I’ve to bury this plugin as well.
Having fed up with the plugins I finally decided to hard code the social media buttons so that it doesn’t slow down blog and also gives me complete flexibility in display.
The first like button which I nailed down was Facebook like button.
I was surprised to discover that it is so simple to add facebook like button in WordPress blog.
Here is the code for facebook like button.
[php]<iframe src="http://www.facebook.com/plugins/like.php?href=<?php echo urlencode(get_permalink($post->ID)); ?>&layout=button_count&show_faces=false&width=450&action=like&font=arial&colorscheme=light&height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:80px; height:21px;" allowTransparency="true"> </iframe>[/php]
You can copy above code in the post loop in single post, page or home page. I prefer to have it only in the single posts.
You can see it live in action on Tennis blog, see it on single post – Maria Sharapova’s Profile
How and where to add the above code.
From WordPress Admin -> Theme Editor
Look for single.php in right colum, click on the link and it will open file to edit.
Search for following line
[php]<?php if (have_posts()) : while (have_posts()) : the_post(); ?>[/php]
Paste the facebook button code below this line where you want to make it appear.
Customization of facebook button
For the customization of facebok like button check out Facebook Like button.
Leave a Reply