How to: Add a simple Facebook share button to your Blog posts in 5 simple steps

There’s a plugin for everything nowadays in wordpress but some plug-in just doesn’t work like we want them to work.. One of them is the Facebook share-me plugin. Although it gives you a counter just like the digg button, sometimes its really hard to customize and share it in the place where we want it on the page. So, I figured out a way to add the Facebook share-me without a plugin and you can add it in 5 simple steps in your blogger or WordPress blog posts.

Things you need:

1. A Facebook share button, if you don’t have one use the image link below. [facebook share ]

http://thesharath.com/img/share-me-fb-button.jpg

Here is how you can add Facebook share-me in just 5 simple steps:

For Blogger blogs:

1. Write your blog post

write a blogger post

2. Publish it

publish post

3. Now copy the published blog URL and Edit the published page again. [Eg. http://sharath-g.blogspot.com/2009/10/testing-facebook-share-plugin.html]

copy link blog post

4. Grab this code and put in your URL

<a href="http://www.facebook.com/sharer.php?u=ENTERYOURPOSTURLHERE"><img src="http://thesharath.com/img/share-me-fb-button.jpg" alt="share to facebook button"></a>

5: Add the code to your post and republish the blog :)

Now try adding using the Facebook share button.

done adding facebook shareme

For WordPress blogs:

If you are adding Facebook share me to your Theme file, just add:

<a href="http://www.facebook.com/sharer.php?u=<?php echo 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . ' ' . $_SERVER['QUERY_STRING']; ?>"><img src="http://thesharath.com/img/share-me-fb-button.jpg" alt="share to facebook button"></a>

This below script is a PHP script which automatically inputs the URL of the page.

<?php echo 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . ' ' . $_SERVER['QUERY_STRING']; ?>

Now isn’t that easy? :) Do you also have any such easy tips and tricks? Share it with us by posting comments below or you can contact us to send a tip!

5 thoughts on “How to: Add a simple Facebook share button to your Blog posts in 5 simple steps

  1. How’s things many thanks pertaining to your post.I really like your web site.Its extremely informative.Nevertheless I definitely want you to post how you put social bookmarking below your post.I like it simply because its a incredibly thoroughly clean awesome blogger hack.
    thank you really much

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>