
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.

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
)
43 Responses
Thanks for the recipe, I’ve already used your recipe for a Twitter Button. Well thanks for all the recipes actually, very useful website !!
Anyway, do you have the recipe to add a “send to friend” button, to send the current article or the current page to a friend by mail ? I don’t wanna use these social bookmarks plugins that add dozens of buttons to send to facebook, twitter, digg, mail, etc.
Thanks again !
Good tips, thanks.
Nice tip. It would be nice to make a tutorial for other social bookmarking sites too.
Simple, I find these types of things by looking at the source code of sites that already use it.
Couldn’t get any easier, could it?
Yan
Thanks again, another great tip
Thanks.. this is awesome.. I just used it
Simple and useful, thanks.
Man, your site rocks! Another bit of extremly useful code, thanx again!!!
Thnaks a lot helpd me as a base for my b2evolution Blog to make something similar .Not that good ,(permalink variables )but working for now
Greets
hi, thx for the code, but it just doesn’t seem to work on my site.
i’m using a theme named ‘gold pot theme’, and it has an embedded ’share on facebook’ icon on its top navigation. it has a user-friendly customization field to tweak the facebook link like this:
Your Facebook profile ID: —————-
(You can find your profile ID by clicking on your profile, you will see an ID number there. Just copy that ID and paste it here!)
i’m entering my facebook id in the profile field: widiantozhu, since i’ve reserved my own facebook username (www.facebook.com/widiantozhu) and can no longer retrieve my facebook profile (number) id. but the problem is, everytime i click on the fb link, it will take me straight to my facebook account page instead of sharing it.
so i open the header.php and replace the with the link code you’ve provided, still nothing changes.
so, can anyone help me with the customization?
thanks a lot guys
sorry to forgot to tell you one thing: this theme (gold pot theme) doesn’t have single.php. that’s why i ask. thx
Thanks for the tip!
i am new user of wordpress blog and i really do not have idea how to do it but i want to creat “share on facebook”button.i read your suggestion but i even do not know how to go the place where i can past the code u have told.so could u please tell me briefly how to do it?if you could do so it would be usefull for lot of new user.
Thank you, I have implemented this, but added a small gif-picture also
I even could not enter to single php and i dnt know what is single php so how can i copy and paste this at the single php…could you please teach me how to go to single php and paste the above code?
I am not very savvy at this stuff. Does the Rounded theme have this option? Where do I find the single.php file?
Thanks for this tip. When I click on the single php file, I click “edit code” and paste your code in the middle of the code already there. I’m assuming this is “in the loop”? When I refresh my site, there is no change. Am I pasting your code in the wrong place?
Thanks,
Kristy
Just what I needed for my blog, thanks
As several other people have asked (and received no answer), where is this “single php” file? I can find no such entity on my site.
@Zak Martin : The single.php file is the file used to display blog posts individually. It can be found on your theme directory.
Great and simple ! Thanks a lot ! Sylvie
ah so simple, I didn’t know that
” The single.php file is the file used to display blog posts individually. It can be found on your theme directory”
I click on Themes and there is no single file listed there. I need a ‘for dummies’ version pls.
Thank you for this great code! I’ve customized the link to facebook, it looks GREAT !!! I will also mesure the number of people clicking on it using Analytics. Thank you again !!
“@Z Martin : The single.php file is the file used to display blog posts individually. It can be found on your theme directory.”
You might as well be speaking Martian. As the guy above said, can we please have the non-techie version?
When I click on the “theme” link at the foot of my individual blog page, I go to a page for RSS feeds. I can’t find any mention of a single-php file, or any way to upload snippets of script. Can you please give us simplified, step-by-step instructions, without assumimg prior knowledge?
Thanks
Trackbacks: