Compact facebook share button with count?
Asked Answered
A

3

5

I am trying to add a simple compact fshare button on my website. The only code I found was this one:

<div style="float:left;padding:4px;">
<a expr:share_url='data:post.url' name='fb_share' rel='nofollow' type='button_count'/>  
<script type="text/javascript" src="http://static.ak.fbcdn.net/connect.php/js/FB.Share"/>
</div>

Which should render as

fshare

But it is not redering correct. It seems it is trying to create multiple buttons and "crashes" all the page. It corrupts the HTML, change the background of a entire div and so on...

fsharecrash

Why is that? Is this the correct code?

Aficionado answered 12/11, 2010 at 12:11 Comment(0)
C
5

Facebook is not recommending the use of the share button anymore, instead you should use the like button. Here is what they say on their website:

We don't recommend the Share button for new developers. If you aren't already using the Share button, we recommend you migrate to the Like button and Open Graph protocol instead of Share for sharing pages from your website. The Like button is simpler to user and is the recommended solution moving forward.

With the like button, you can add it using javascript OR iframe, so you can see which one works best for you. Read more about the like button here.

Cardinalate answered 12/11, 2010 at 12:17 Comment(0)
E
3

http://sharethis.com provides a widget that allows you to include buttons for various social media sites, including the fb share button with count. (It has their own style and size so you may need to override some of the CSS to make it look like the standard FB share.) There is also a solution at http://blog.pixert.com/facebook-share-button/, but I have not been able to get it to display a count.

Etruria answered 28/7, 2011 at 15:47 Comment(0)
M
0

Change your code

 <a expr:share_url='data:post.url' name='fb_share' rel='nofollow' type='button_count'/> 

to

<a expr:share_url='data:post.url' name='fb_share' rel='nofollow' type='button_count'>Share</a>
Mirianmirielle answered 29/6, 2013 at 16:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.