How to manually integrate Facebook Like Button into WordPress
15 February 2011 Pubblicato da Lorenzo Lagana'
Over 500 milion of users.This is a good reason why a blogger need to implement a facebook like button into a blog.
Well, today we will see how to manually integrate the Facebook Like Button into a wordpress blog and for those people, who don’t like fighting with code, via plug-in.

Why we need to add a button “i like it” on a blog ?
The answer to this question is simple: Imagine that every facebook user has a very high average of friends (almost 100).If someone click “I like it” on your article, the potential number of readers increase considerably.
Where do I start ?
First of all we need to go to the official page of Facebook like button generator
In few simple steps you can customize many features of the like button.Facebook offers the possibility to choose 2 different version, standard , wide (450px) or the “count” version, the short one(90px).
Between the various parameters you can choose if you want to view the picture of the users, different color schemes and the font you want.
When you set the parameters just click on get code and then grab the code Iframe
Moving to WordPress
Open the single.php where we will paste che code.
This is the script taken from the Facebook Like Button Official Page:
</pre> <iframe style="border: none; overflow: hidden; width: 450px; height: 80px;" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fexample.com%2Fpage%2Fto%2Flike&layout=standard&show_faces=true&width=450&action=like&colorscheme=light&height=80" frameborder="0" scrolling="no" width="320" height="240"></iframe> <pre>
Now we need to integrate the wordpress permalink reference of the article of your blog , so we have to replace the href on the iframe with the get_permalinkcode of wordpress.
<!--?php get_permalink(); ?-->
And that’s what we obtain:
</pre> <iframe src=""http://www.facebook.com/plugins/like.php?href=<?php" width="320" height="240"></iframe> <h2>Important</h2> In order to avoid errors on the facebook reference <strong>is extremely important to replace the ; with & inside the iframe</strong>. So this is the final code: [code]</pre> <iframe style="border: none; overflow: hidden; width: 450px; height: 35px;" src="http://www.facebook.com/plugins/like.php?href=<?php the_permalink() ?>& layout=standard&&show_faces=false&&width=450&&action=like&&colorscheme=light&&height=35" frameborder="0" scrolling="no" width="320" height="240"></iframe> <pre>
Where to put the code ?
Is extremely important to put the iframe code inside the loop:
<!--?php if (have_posts()) : ?--> <!--?php while (have_posts()) : the_post(); ?--> <!--?php the_content(); ?--></pre> <iframe style="border: none; overflow: hidden; width: 450px; height: 35px;" src="http://www.facebook.com/plugins/like.php?href=<?php the_permalink() ?>& layout=standard&&show_faces=false&&width=450&&action=like&&colorscheme=light&&height=35" frameborder="0" scrolling="no" width="320" height="240"></iframe> <pre> <!--?php endwhile; else: ?--> <!--?php endif; ?-->
Now your facebook like button is ready!
I hate code, i need a simple plug-in
For the non-expert user there is a plug-in to install easily the facebook like button : WP FB Like.
In a few steps and in easy way you can set all the parameters of the button and decide his position , before or after the content.






Pingback: Tweets that mention How to manually integrate Facebook Like Button into Wordpress | llow -- Topsy.com