// you’re reading...

Facebook

How to add the Facebook ‘Like’ Button to your WordPress Blog

After Facebook’s presentation at F8 and Ed Dale’s post highlighting the importance of this ‘Like’ button I decided to add it to my WordPress Posts.

I assume a nice little plugin will come out soon, if it hasn’t already and I’ve missed it, but until then here is a simple way to add it.

Well here is the way I did it anyway :) It is simple but you do have to edit the main template files so be VERY careful. I do suggest that you have the Pretty Link Plugin installed.

Login to an account that has Admin privileges.

On the left, under Appearance, click on Editor.

On the right hand side where the list of files are, look for “Main Index Template (main.php)”, and open it.

Once the editor opens the file look for the line

<?php the_content("<p>Read the rest of this entry »</p>"); ?>

Underneath this line paste the code below

<?php echo '<iframe src="http://www.facebook.com/plugins/like.php?href=', urlencode(get_permalink()), '&layout=standard&show_faces=true&width=450&action=like&colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:25px"></iframe>'; ?>

Save the file. You are half way done. Now if you view the Front Page of your blog you should notice a “Like” link.

Then open the file “Single Post (single.php)” and follow the same procedure

Once the editor opens the file look for the line

<?php the_content("<p>Read the rest of this entry »</p>"); ?>

Underneath this line paste the code below

<?php echo '<iframe src="http://www.facebook.com/plugins/like.php?href=', urlencode(get_permalink()), '&layout=standard&show_faces=true&width=450&action=like&colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:25px"></iframe>'; ?>

There you should be done now. Both the Front Page and the individual posts should have “Like” buttons and you should be able to take advantage of some more traffic. Hopefully! ;)

I hope this helps some of you.

On the off chance you flew over to the USA to pickup your iPad and now you’d rather not lose it, or for that matter your keys. Why not check out my Lost and Found site.

Reblog this post [with Zemanta]

Technorati Tags: , , , , , , ,