A Facebook share button on a website allows people to share the content directly on their Facebook wall. As Facebook has discontinued the share button, they are no more providing an official widget for it. But people still want to add Facebook share button on their websites and blogs; even with different formats along with the total share count of the posts. This guide will show you how to easily add Facebook share button to your website or blog.

Adding Facebook share button on website / Blog

Follow the below given steps to add Facebook share button to your website or blog:

Facebook share button for Website

Edit the source code of the page of your site in which you want to put Facebook share button. Add the below code in the page’s source where you want to show the button:

<a name="fb_share" type="button">Share</a>
<script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script>

Save the changes.

Facebook share button for WordPress

Go to your theme directory and open single.php in editing mode. Put the below given code just * above / below <?php the_content(); ?>:

<a name="fb_share" type="button" share_url="<?php the_permalink(); ?>">Share</a>
<script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script>

Save Changes.

Facebook share button for Blogger

Log in to you Blogger account and go to Blogger Dashboard » Design » Edit HTML. Find <data:post.body />, paste the following code * above / below it:

<a name='fb_share' type='button' expr:share_url='data:post.url'>Share</a>
<script src='http://static.ak.fbcdn.net/connect.php/js/FB.Share' type='text/javascript'></script>

Save Template. If it shows error message like:

More than one widget was found with id: Navbar1. Widget IDs should be unique.

Just find Navbar1 (or the id it is showing in the error message) and replace it with Navbar2 (do make sure that a different Navbar2 doesn’t exists in your blogger template).

Facebook share button for Tumblr

Go to your Tumblr Dashboard » Edit » HTML. Find {blocks:Posts} and paste the following code * above / below it:

<a name="fb_share" type="button" share_url="{Permalink}">Share</a>
<script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script>

Click Update.

Facebook share button for Posterous

In your Posterous dashboard, navigate to Manage Spaces » Space Settings » Edit Theme » Advanced, and find <section class=”share”>, add the following code just below it:

<a name="fb_share" type="button" share_url="{Permalink}">Share</a>

Save the changes. You can see the button in action here.

* above / below: Wherever you want to make it appear either above the post or at the footer of the post.

You can alter the following parameters to customize your Facebook share button:

ParameterFunctionPossible Values
typeHow share data appearsbutton (simple button with no count), button_count (horizontal share count), box_count (vertical share count), icon_link (icon with “share” link), ion.
If not specified, the button will appear as simple button with no count.
share_urlURL of the document to be sharedThe URL of the document to be shared. It could be <?php the_permalink(); ?> if you use WordPress or some other similar function for different platforms. If not specified, it will automatically pick the page’s URL where it is placed.

Quick Tip: Use Ctrl + F or Command + F to find the code in your browser.

Also see Educational Social Media Graphics and be a fan at Facebook.