How to Add Facebook Like Button to Your WordPress Blog Posts

Facebook recently launched a web wide Like button which allows everyone to add Like buttons on every page of their site. With in hours of launching everyone started adding buttons on their site. The bloggers who use WordPress platform for blogging didn’t stay behind in the race, they also started adding the button on their blog and very soon the button started appearing on thousands of blogs.

Let me tell you how can you add the Facebook Like button on you WordPress Blog with in 5 minutes, without any extra plugin.

Goto the your WordPress theme directory and open the file single.php and add the following code snippet to appropriate position in your file.

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

The above code adds an iFrame to your site which displays the Facebook Like button. You can modify the look & feel of the button by changing following parameters in the iFrame URL.

Facebook Like Standard Layout

Layout:

The above example uses the layout “standard” but you can also use the “button_count” layout which will display Like button as follows:
“layout=standard”

Facebook Layout Button Count

Show Face:

If you wish to show the friends who have already liked the page, then use the option “show_face=true”.

Color Scheme:

If you want to use the dark color scheme use the parameter of colorscheme to change the colors. You can use “dark” as follows to use the dark color scheme for your Like button.

“colorscheme=dark”

Facebook Like Dark ColorScheme

Are you using Facebook Like button on your blog? Are you seeing any results? Share your success story with us!

Published by

Hameedullah Khan

VR enthusiast, Cloud Architect, Passionate Programmer and Opensource advocate.

Leave a Reply

Your email address will not be published. Required fields are marked *

CommentLuv badge