Posts Tagged ‘ like button ’

8
22
Apr

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&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=recommend&amp;font=arial&amp;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)); ?>&amp;layout=standard&amp;show-faces=true&amp;width=500&amp;action=like&amp;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