Add Facebook “Share” Button to Each Post

This document is deprecated! The information on this page refers to a Thesis version that is now obsolete. Please visit the Thesis Docs for current documentation.

FaceBook has deprecated the Share button in favor of the Like button — as such, the information in the article is no longer valid, and should not be relied upon.

If you’re using the Thesis Theme Framework, it’s easy to add the Facebook “Share” button to each of your WordPress articles. All you have to do is place the following code in custom_functions.php:

function fb_share() { 
if (is_single()) { ?>

<div class="fb_share">
    <a name="fb_share" type="box_count" share_url="<?php the_permalink() ?>"
      href="http://www.facebook.com/sharer.php">Share</a>
    <script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script>
</div>
<?php } 
}

add_action('thesis_hook_byline_item','fb_share');

Note: The Facebook Share button is much different than the FaceBook “Like” button. When you use the Share Button, you empower your readers to add additional commentary around your link. Plus, when they Share it as opposed to Like it, you’ll get more visibility in their Facebook feed.