Integrate Facebook’s Like Button into WordPress
Facebook’s new Like The Internet takeover is underway. I think I like it despite privacy concerns. I can fiddle with my facebook privacy settings or simply choose not to ‘like’ stuff I don’t care to share. But, I can see the benefits for driving traffic bigtime.
I’ve been playing with it tonight and was having trouble getting the Like button to share a specific post. Instead, Facebook’s default iframe code that spits out is URL-specific. But with the miracle of PHP (and until someone creates a nifty plugin), you can substitute the URL with this:
…like.php?href=<?php echo urlencode(get_permalink($post->ID)); ?>
So instead of this:
<iframe src=”http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.stephanieromanski.com&layout=standard&show_faces=true&width=450&action=recommend&font=arial&colorscheme=light” scrolling=”no” frameborder=”0″ allowTransparency=”true” style=”border:none; overflow:hidden; width:450px; height:px”></iframe>
You get this:
<iframe src=”http://www.facebook.com/plugins/like.php?href=<?php echo urlencode(get_permalink($post->ID)); ?>&layout=standard&show-faces=true&width=500&action=like&colorscheme=light” scrolling=”no” frameborder=”0″ allowTransparency=”true” style=”border:none; overflow:hidden; width:500px; height:60px”></iframe>
Post this on your single.php page and voila.
—
[UPDATE] Well, I’m too slow. There already is a WordPress plugin
Get it here
