How do I add a Facebook button to my blog?

I'd like to add a "share on facebook" button to my blog. I'm currently using a self hosted Wordpress blog. I know this can be achieved by using a plugin but I'd like to keep my blog as simple as possible and by adding a plugin for simple stuff like a Facebook button, I feel I'm just adding clutter. I know there is a way to accomplish this just by inserting a line of code.
How can I do it?

asked by Thimble in Design | 5786 views | 06-07-2009 at 04:39 PM

If you want to add a "Send to Facebook" button for your Wordpress blog follow these simple steps:

1. Open the single.php file in your theme.
2. Paste the following code in the loop:

HTML Code:
<a href="http://www.facebook.com/sharer.php?u=<?php the_permalink();?>&t=<?php the_title(); ?>" target="blank">Share on Facebook</a>
3. And that's it. Now your readers will be able to share your blog post on Facebook with all their friends.

Can you explain the code?
Of course. This hack is easy to understand: what we do here is retrieve the post's permalink and title and send them as parameters to http://www.facebook.com/sharer.php.

If you have any more questions, please ask.

answered by Jack | 06-07-2009 at 04:46 PM

Already added a facebook button to my blog following the instructions.
It's very easy, thanks for the explanation.

answered by Guest | 10-15-2009 at 10:54 AM

Wordpress plugin
Here's the Facebook Like button plugin (for the new Like button released April 21st 2010) available from Wordpress:

http://wordpress.org/extend/plugins/like

No coding necessary, you can customize the look and placement of the button in the settings interface

answered by Bottomless | 04-30-2010 at 08:15 AM

comment
Thread Tools
vBulletin® Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.