Facebook like button on my posts

Wanted to test placing facebook like button on my blog, just breaking down the steps how i added it to my posts.

How to Put Facebook Like Button On WordPress Blog posts

  1. Open the single.php from wp-content/themes
  2. Then find the lines where the post loop is running, it differs from theme to theme.
  3. I found the <div> containing the post loop for my twentyten theme

    <div id=”post-<?php the_ID(); ?>” <?php post_class(); ?>>
    </div><!– #post-## –>

  4. so i put this code right before the <div> ended containing the post loop.

    <iframe src=”http://www.facebook.com/plugins/like.php?href=<?php echo urlencode(get_permalink($post->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>

  5. Added the code wherever I wanted the button to appear.
  6. Adjusted the parameters like show_face=true/false and colorscheme=dark/light depending on preferences.
  7. Saved the template.

Here it was, the Facebook Like Button at the bottom of each posts. Done.

This entry was posted in Designers View. Bookmark the permalink.

Leave a reply