DISCLAIMER: this post is older than one year and may not be up to date with latest WordPress version.

As you know it, facebook is a very popular website, which allow you to share webpages you like with your friends. In order to promote your blog and gain some more traffic, you should definitely add a “Share on Facebook” link to your blog.

Simply paste the following code on your single.php file, within the loop:

<a href="http://www.facebook.com/sharer.php?u=<?php the_permalink();?>&t=<?php the_title(); ?>" target="blank">Share on Facebook</a>

That’s all. Your readers are now able to send your blog post on Facebook and share it with their friends!
(PS: I’m not on facebook, so don’t ask 😉 )


  1. Wondering if you knew how to get the Like on FB (or “Share This Blog”) when one doesn’t have a custom blog theme? I don’t have a place to put plug-in info (I’m at wordpress).


  2. when i add the code to single.php it only shows the like button on the new posts and not the old ones. can i add it to the old ones too?

  3. dont forgot the head application in your theme folder

  4. could you share the the code for placing it in the functions.php file to prevent future upgrade overwrites? Thanks!!

  5. Minor amend to this would be to make the link contain & not & to help with HTML validation :)

  6. It would be nice to know where single.php is. I’ve looked through all the directories and can’t find it.

  7. Paulo Gomide

    Donald, to find single.php go to “yourblog”/wp-content/themes/”anyThemeThatYouChoose

  8. Where would that single.php file be located? I am new at this and cannot find it.

  9. Actully, I don’t even know where to look for these directories you are talking about. I put the link in my browser that you stated above and that didn’t work. Please tell this challenged individual exactly what you mean in simple terms.

  10. http://en.forums.wordpress.com/topic/its-possible-facebook-share-and-like-buttonsat-the-same-time?replies=90

    This helped me…the button doesn’t look quite the way I want, but now I know where to put the info to make it work.

    Hope it helps you.

  11. This was helpful! I´ve taken it a little further though:



  12. I copied the code at the top of the page and it worked great but the Sh is not centered. What do I add to the code that would center it like the others.

  13. I got a question.
    i’ve used the code successfully, but i want to open a new popup window once the link is clicked.

    any help

  14. I dont think, you will get any solution for this after one year :)

  15. maybe someone could post a script of his work so you can copy what he or she did?

  16. Excellent blog post. I definitely appreciate this site. Keep writing!

  17. I like this script a lot. One question though, it doesn’t seem to pull images when clicked. Any ideas how to add that as well?

  18. Well, it dosnt work at IE, but who really cares about that?

  19. Well It works, but the og:description and og: title are pulled from the website.

    I wonder if it is possible to pull the description from individual posts…

  20. You can put the code on the footer php or even on the widget area.

  21. i past in in function.php …my site crashed …careful

  22. I do believe all the ideas you have introduced on your post.
    They are very convincing and will certainly work. Still, the posts are very short for starters.

    Could you please extend them a little from next
    time? Thanks for the post.

  23. Hello there! This is my first comment here so I just
    wanted to give a quick shout out and tell you I really enjoy reading
    your blog posts. Can you recommend any other blogs/websites/forums that go over the same subjects?
    Thank you!

  24. Check out the latest study on molecular nutrition and food research scientists that show that compounds in mate tea induce death in colon cancer cells.
    The cold version of the tea is popularly called Terere.
    The best time is generally the first hour after breakfast.

  25. So simple …. Love it :-)

Leave a Comment

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