With the enormous userbase on Facebook, the new “Like buttons” from Facebook is also something you should consider for your WordPress based blog.
There are already plugins that can insert Like buttons on your blog, but since the implementation is very easy, including a plugin for this limited amount of functionality sounds like overkill to me.
Why implement a Like button
The like buttons from Facebook can be a very effective way of promoting your blog.
When a user clicks on the Like button two interesting things happens:
- A update is added to the users Facebook wall, saying that the user likes the post (including a link to the post)
- If some of the users Facebook connections visits the post, they can see that the user likes the post, and therefore maybe has a more positive attitude towards the post.
Like button – iframe
The simplest way of implementing the Like button is by using a iframe.
The iframe below is optimized for WordPress, as it dynamically inserts the permalink to the current page as the page to bookmark on Facebook.
To install the Like button as a iframe, go to “Appearance->Editor” and select the page where you want to insert the button. Typically you want to insert the button on the single post template: “single.php”
<iframe src="http://www.facebook.com/plugins/like.php?href=<?php echo urlencode(get_permalink($post->ID)); ?>&layout=standard&show_faces=false&width=450&action=like&colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:60px;"></iframe>
Like button – XFBML
You identify the WordPress templates where you want to implement the Like button, tha same way as with the ifrme, but you just need to add the following code where you want teh button to appear:
<fb:like href="<?php the_permalink() ?>"></fb:like>
The XFBML has a few advantages compared to the iframe:
- The XFBML version allows users to add a comment to their like as it is posted back to Facebook.
- The XFBML version also dynamically sizes its height; for example, if there are no profile pictures to display, the plugin will only be tall enough for the button itself
As you can see, adding the new Facebook Like buttons to your WordPress based blog is very simple.