2

Has anyone added this kind of functionality to a WP site before? I'm looking to add Facebook Like button to individual comments. This can be a Theme function or a plugin

3
  • The best answer I have found is to add the Like Button iFrame for each comment either via plugin hook or in the theme options..
    – abrudtkuhl
    Oct 19, 2010 at 17:03
  • Doesn't that slow your site down like a beast? I've found that even including a couple like button iframes on a page adds several seconds to page load time. I haven't tried out the FB JavaScript SDK yet, but I would think that might be a better way to go, if you're talking about including alot of these buttons on a page. Oct 19, 2010 at 21:19
  • Good point that would cause some load issues... The JS SDK would have to be a better choice
    – abrudtkuhl
    Oct 21, 2010 at 15:06

1 Answer 1

3

You should add the list of comments within the comments.php file the following code:

<iframe src="http://www.facebook.com/plugins/like.php?href=<?php echo urlencode(post_permalink() . '#comment-' . comment_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>

And then customize the display rules in the stylesheet. Hope that helps. ;)

2
  • Will probably be next to the item <?php comment_text(); ?> Oct 19, 2010 at 17:31
  • Awesome that's the direction I was leaning... Thanks! May try to hack that into a plugin for others to use as well
    – abrudtkuhl
    Oct 19, 2010 at 18:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.