Post Pic

How to: Add a “Share on facebook” link to your WordPress blog

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 ;) )

7 Responses

Sep 11 2011 03:30

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).

Thanks!

Sep 25 2011 11:18

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?

Nov 29 2011 06:34

dont forgot the head application in your theme folder

Dec 29 2011 23:25

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

Jan 11 2012 17:01

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

Jan 14 2012 15:55

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

Jan 27 2012 21:08

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

Trackbacks:

Leave a Comment

* Name, Email, Comment are Required