Now Reading
How to add FB Like to every post
1

How to add FB Like to every post

by Jason GreenApril 23, 2010

How to add the Facebook “Like” button on every post in any theme.

It’s quite simple actually, I’ll guide you through the whole process after the jump…

Getting Started adding a FB Like button to all posts in your theme:

Open one of the template files for your theme where you would like the button to be. Let’s say we want a button after the title in every post, so we would need to edit single.php

Where ever you want the code to appear, just drop in the following line of code: (Remove all the line breaks, this is a one liner.)

<iframe src="http://www.facebook.com/plugins/like.php?href=<?php
the_permalink()
?>&amp;layout=standard&amp;show_faces=false&amp;width=300&amp;
action=like&amp;font=segoe+ui&amp;colorscheme=evil"
scrolling="no" frameborder="0" allowTransparency="true" 
style="border:none; overflow:hidden; width:300px; height:30px">
</iframe>

Valid options for show_faces is true or false. True Shows faces and False doesn’t. Pretty simple.

Colorscheme is light, dark or evil. I choose evil, but I’m not sure what’s evil about it. Looks just the same as light does to me.

Obviously the width and height need to be adjusted to your theme and the placement in your theme to suit it best.

*In the code above, anything marked in this color is what you can change to customize it, or use the customization wizard located at: http://developers.facebook.com/docs/reference/plugins/like If you make your own using the wizard, don’t forget for the to add the Pink code after you generate your button, for the URL just put in blank.com and customize like you want. Then replace blank.com with<?php the_permalink() ?> for using in your wordpress theme.

About The Author
Jason Green
The writer and owner of Green Complex, Jason is an A+ Certified for Computer Hardware egghead and Eagle Scout since 1999 but has been building computers and programming for much longer. An enthusiast to say the least, his hobbies also include photography, video games, and reading. See his proficiencies on Smarterer.
1 Comments

You must log in to post a comment