Expert Warrior Needed - Wordpress Comment / Facebook "Like" Integration

by Kekoa
6 replies
I have not seen this on any blog before.

I would like to have a facebook "like" button on every comment posted on my wordpress blog. Now I want the like button to "like" the comment permalink that it is attached to. I figured out how to "like" the current page url, but I could not figure out how to get it to "like" its respective comment.

Some of the comments on my blog are rather insightful and sometimes hilarious. I KNOW that if there were a like button for those particular comments, they would go viral on facebook.

This is what it looks like:



So I need to know what I have to hard code into the functions.php page in order to accomplish this.

Code:
<iframe src="http://www.facebook.com/plugins/like.php?href=<?php the_permalink(); ?>&amp;layout=button_count&amp;show_faces=true&amp;width=200&amp;action=like&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px; height:21px;" allowTransparency="true"></iframe>
I need to change <?php the_permalink(); ?> to ?????

I tried changing it to this ----> <?php permalink_comments_rss(); ?> and it doesn't work.

Your help is appreciated.


Aloha, Kekoa!
#comment #expert #facebook #integration #needed #warrior #wordpress
  • Profile picture of the author getsmartt
    hmm found this I think you can make it work for you...

    Create a permalink for each comment in a post.
    Code:
    <a href="#comment-<?php comment_ID() ?>">#</a>
    Signature

    Was mich nicht umbringt, macht mich stärker

    {{ DiscussionBoard.errors[2969649].message }}
    • Profile picture of the author Kekoa
      Originally Posted by getsmartt View Post

      hmm found this I think you can make it work for you...

      Create a permalink for each comment in a post.
      Code:
      <a href="#comment-<?php comment_ID() ?>">#</a>
      That didn't work. If you look at the code I provided, I need to replace the <?php the_permalink(); ?> with the a permalink to the comment.
      {{ DiscussionBoard.errors[2969930].message }}
      • Profile picture of the author getsmartt
        Originally Posted by Kekoa Chung View Post

        That didn't work. If you look at the code I provided, I need to replace the <?php the_permalink(); ?> with the a permalink to the comment.

        Since all comments on a WP plog have a URL such as
        blogname/post/#comment-31092

        Your permlink should be
        Code:
        <?php the_permlink();>/#comment-<?php comment_ID();?>
        Or something similar.
        Signature

        Was mich nicht umbringt, macht mich stärker

        {{ DiscussionBoard.errors[2972779].message }}
  • Profile picture of the author ChrisCree
    The other thing to keep in mind is that you are going to have to make sure your code goes into the comments loop and not the main post loop. Depending on what theme you are using you will either have to edit your commments.php file instead of your functions.php OR, if your theme uses hooks (like Genesis, Thesis, or Headway do for example), make sure you use the right hook to get your code to display in the comments section and not just once per post.
    {{ DiscussionBoard.errors[2969736].message }}
    • Profile picture of the author Kekoa
      Originally Posted by ChrisCree View Post

      The other thing to keep in mind is that you are going to have to make sure your code goes into the comments loop and not the main post loop. Depending on what theme you are using you will either have to edit your commments.php file instead of your functions.php OR, if your theme uses hooks (like Genesis, Thesis, or Headway do for example), make sure you use the right hook to get your code to display in the comments section and not just once per post.
      Thanks for that tip, I am using the twenty ten theme, and the comments loop is in the functions.php page.

      If any one knows how to do this, send me the code that I need to plugin to the functions.php page, already coded.

      To spice things up, I'll ship a few bucks via paypal to the first person that can figure this out. (nothing much, just enough to buy a drink or two)

      I know this would help others also in getting more free traffic to their blogs, via facebook.
      {{ DiscussionBoard.errors[2969951].message }}
  • Profile picture of the author Istvan Horvath
    Lines #315-318 in twentyten functions.php

    PHP Code:
    <a href="<?php echo esc_urlget_comment_link(  ) ); ?>">
                <?php
                    
    /* translators: 1: date, 2: time */
                    
    printf__'%1 at %2''twentyten' ), get_comment_date(),  get_comment_time() ); ?></a>
    Whatever is between the a href and the closing /a tag is the comment's individual permalink
    Signature

    {{ DiscussionBoard.errors[2973328].message }}

Trending Topics