Official Facebook Share Count Button for your WordPress

Posted on October 27th, 2009 by in Tutorials | 21 Comments  
Official Facebook Share Count Button for your WordPress

Not too long ago we shared how you can add a live facebook share button in your WordPress site using a third party script. Well Facebook has decided to release the official version of the fshare count button, so why rely on the third party script anymore?

To add the Official Facebook Share button simply open up a theme file of your choice and add the following code:

<a name="fb_share" type="box_count" href="http://www.facebook.com/sharer.php">Share</a><script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script>

The code above will add a big tweetmeme like button that will display count in more like a box form. If you want to display a compact version then simply use the code below:

<a name="fb_share" type="button_count" href="http://www.facebook.com/sharer.php">Share</a><script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script>

Feel free to wrap the codes around with any styling that you like. For further documentation and options visit the Official Facebook page.

About

Editorial Staff at WPBeginner mainly Syed and David.

Post comment as twitter logo facebook logo
Sort: Newest | Oldest
SangramKeshariPatra 5 pts

I don't want "207 people like this. Be the first of your friends." this text on my facebook like share button ..

Then,is there any way to remove this text and button ?

wpbeginner 50 pts moderator

SangramKeshariPatra yes, you changed the button type from standard to button_count or box_count

tahirtaous 5 pts

Hello, i have added facebook share and send button on my site, i am using buddypress and added this code in bp child theme, but when i click on send and share button following code is displayed on send and share form, how can i remove this code, please thelp me.

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>

here is an image of error.

https://lh4.googleusercontent.com/-u000wjMhuP0/Tp2...

CorinaPopescu 5 pts

Another nice implementation for a Facebook Sharer you can find here: http://www.facebook-sharer.com

hurkal 5 pts

Is that still working? Share count for my site does not show the value. Is Facebook avoiding continue this work further? If so, is there a way to get latest share value?

wpbeginner 50 pts moderator

hurkal Facebook is depracating the share button in favor of the like button. The like count is the same as the facebook share count.

ZainabQureshi 5 pts

The code works really well, the only problem i see is that the count updates whenever i click on the button no matter if i have shared it previously or not.. =S is there a fix to that, that the button does not updates the count if the same person is clicking on the share button?

hi! This button doesn't work well with the latest update of Wordpress version anymore. Is there any alternative for this? Thanks

Yes. Facebook has announced that the like button will eventually replace this sharer button. Because it is being used on a lot of sites, they haven't pulled the plug yet. But it will be gone sooner or later. We recommend that you switch to using the Like button.

I should add this button on my new blog then. Hopefully, adding this button will drive more visitor to my new blog.:) Thanks for sharing this.:)

I've tried adding the share_url parameter and still have the counter box disappearing with each page refresh.

That is wrong, It is because it needs to bee shared in order for the box to come up.
Add this
share_url="((your Page))"
To

and share it. see if the box comes up

You shouldn't need to have to do this because of the canonical URL system built-in to WordPress, but if you must, you can add that.

Unfortunately, I'm having the same issue as Shannon above had ... it shows up only as a small button with an "F" on it. I clicked it myself and went through the steps of sharing it on Facebook and the image then changed to show a count of "1." I then refreshed the page and it changed back to a small icon with just the "F" - no count was shown. I checked FB to ensure that it did, in fact, post to my wall.

I copied your first set of code into my theme via OpenHook in Thesis and placed it after my posts.

I'm not sure what is going wrong?

Also having this issue on my site. Count disappears after refresh.

This is not working as advertised. The button shows up but it doesn't not display share counts after refreshing the page.

It has been working on many sites, do not know what the issue could be with yours. We are planning on including it in our next update as well.

I'm having the same issue. The counter displays once clicked to share, but when you return to the page it is gone.

Tweets about us: