Have a website? Whether or not you also have a Facebook page, Facebook’s Like button could help bring readers to your content when used well.
What the Like button offered
The Like button let readers show their appreciation and, more importantly, recommend content to their friends. Imagine ten friends liking an article, each with an audience of around 300 friends, and some of those people sharing it again. You get the idea: things could travel too very quickly on Facebook.
Add Facebook Open Graph to your WordPress theme
Some sites linked the button to their homepage instead of the article being read. Others showed the wrong image, description, or title on Facebook. To make the preview match the article, add Facebook Open Graph metadata to your WordPress theme. The companion tutorial explains how.
Embed the button
Once the Open Graph metadata is in place, add the following code wherever you want the Facebook button to appear. In the classic WordPress theme used in this tutorial, that meant opening single.php and inserting it where you wanted the button to appear:
| 1 2 3 | <iframe src=”http://www.facebook.com/plugins/like.php?href=<?php echo urlencode(get_permalink($post->ID)); ?>&layout=standard&show_faces=false& width=450&action=like&colorscheme=light” scrolling=”no” frameborder=”0″ allowTransparency=”true” style=”border:none; overflow:hidden; width:450px; height:60px;”> </iframe> |
Here’s what you could customize in this version of the button:
Layout
layout=standard displays the standard layout with text and, when enabled, friends’ photos.
layout=button_count displays a compact button and count.
layout=box_count puts the count above the button.
Friends’ photos
Use show_faces=true to show friends who liked the content below the button, or show_faces=false to hide them.
Width
width=450 sets the button area to 450px wide. Adjust it to fit your layout.
Button text
action=like displays ‘Like.’ Replace it with action=recommend to display ‘Recommend.’
Color scheme
Use colorscheme=light for a light appearance or colorscheme=dark for a dark one.




