I need a social media plugin just for FB. I need big share buttons for FB. I have seen it in several websites but I do not know which one it is.
I leave this link to show you what I am talking about (big FB buttons at the beginning and ending of the article):
http://www.viralnova.com/animals-eating-ice-cream/
Any idea?
There's no secret sauce for making big like (that's not a like button, that's share button) button it all comes down to basic knowledge in Facebook developers tools ...
Facebook has the Sharer which accept the GET parameter u which is the URL you want to share on your timeline, on a friend's wall or even in a private message ...
Break Down
You can create a new element or wrapper for your share button I will just use <a> because they seems quick and easy to use for this purpose.
<a class="fsl fsl-facebook" data-href="{URL_to_Share}" href="#">
<span class="fa-facebook fa-icons fa-lg"></span>
<span class="sc-label">Share on Facebook</span>
</a>
pay attention to data-href attribute as you should replace it with the URL you want to share
next we need some JavaScript (jQuery) to make our share button do something
$('.fsl-facebook').click(function(e){ // target all elements with fsl-facebook class in the DOM
e.preventDefault(); // prevent scrolling to top or bottom, because href is set to #
var href = $(this).attr('data-href'); // get URL from the data-href
window.open('https://www.facebook.com/sharer/sharer.php?u=' + encodeURIComponent(href), "", "width=800, height=350"); // pop up a new window, it's prefered to urlencode the URL because of 2nd & 3rd GET parameter that can be found in some URLs (?a=1&b=2&c=3)
});
DEMO
Related
I've following code:
<span><small>
<i class="fa fa-heart"></i>56 Likes
</small></span>
which gives like button as :
I've included facebook like button as instructed in:
https://developers.facebook.com/docs/plugins/like-button
But I need same functionality. So that when user clicks on the heart icon it get liked and increases count number.
You need to autorize the user and use og.likes:
https://developers.facebook.com/docs/reference/opengraph/action-type/og.likes
It is not possible to copy the functionality of the Like Button in any other way afaik. You are not allowed to change the appearance of the Like Button anyway:
Don’t obscure or cover elements of social plugins
Source: https://developers.facebook.com/policy/
I am stuck with this one...
I have a website that plays music. The page updates automatically to display the current song being played and the image of the artist. The website also allows visitors to request songs. What I want to do is allow users to then share their request on Facebook, so I have added the code below.
Initially, when you pressed the Facebook button, it would pop up iwth a box which contained all the correct info (song, artist, image, etc), but would not post correctly to Facebook (the dynamic info such as title and image would be missing). Now, recently, it doesn't even populate the pop up correctly.
I'm stuck and cannot figure out how to get this to work correctly, can anyone help me?
Thanks.
<a class="facebook" target="_blank" onclick="return !window.open(this.href, 'Facebook', 'width=640,height=300')" href="http://www.facebook.com/sharer.php?s=100&p[title]=I'm listening to <?php echo $currentSong->title . ' by ' . $currentSong->artist; ?>&p[summary]=Join me and listen right now or request your own song&p[url]=http://www.mydomain.com&p[images[0]=<?php echo $largeimg; ?>"><img src="http://www.mydomain.com/new/images/facebook.png" width="32" height="32" border="0" style="padding-top:5px; padding-right:4px "></a>
Actually, you should only add the URL as parameter (url encoded) to the sharer.php:
<img ... />
It automatically takes the Open Graph data from the shared URL, see this page: http://ogp.me/
I assume all the other parameters are deprecated, at least it did not work for me some months ago. The only thing you could try is to encode all data with the PHP function "urlencode" - but i would suggest using the correct way and implement Open Graph correctly. That way you can even just take the URL, put it on Facebook manually and it will take the correct data.
If the content is completely dynamic, you should consider using Open Graph Actions: https://developers.facebook.com/docs/opengraph/
Or if that is too complicated, use the FB.ui feed dialog:
https://developers.facebook.com/docs/reference/dialogs/feed/
...but don´t forget to include the JavaScript SDK:
https://developers.facebook.com/docs/javascript/quickstart
I am trying to add text to a facebook share link after it pops up. I have looked through the facebook dev site and searched online and the only thing that looked like it might remotely work was adding in meta tags for the Graph API. But I couldn't get them to work or display anything.
Below is the code for the button
<script>
function fbs_click() {
u=location.href;
t='Where is your kind of crowd? Ask StreetPotato';
window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');
return false;
}
</script>
<a rel="nofollow" href="#"
class="fb_share_button social" onclick="return fbs_click()"
target="_blank"
style="text-decoration:none;"
title='Follow us on Facebook'>
<%=image_tag "social/facebook.png", alt:"Follow us on Facebook"%>
</a>
If anyone has any insight or idea how to add in default text, like a hash-tag into the share text box it would be awesome. Thanks for reading.
-Alan
In general, you should not pre-populate any of the Facebook social dialogs that will post on behalf of a user.
See IV.2 of the Platform Policy doc:
"You must not pre-fill any of the fields associated with the following products, unless the user manually generated the content earlier in the workflow: Stream stories (user_message parameter for Facebook.streamPublish and FB.Connect.streamPublish, and message parameter for stream.publish), Photos (caption), Videos (description), Notes (title and content), Links (comment), and Jabber/XMPP"
When using the javascript sdk the app opens a dialog with a link, facebook will fetch some sort of a display for that link, based on the og tags in it, and will put it inside an element with id "UIStoryAttachment".
Is there a way to somehow produce the same UIStoryAttachment display inside a container element of my choice? like, for example something similar to:
<div id="storyContainer">
<div class="fb-story" data-url="MY_PAGE_URL"></div>
</div>
And then:
FB.XFBML.parse(document.getElementById("storyContainer"));
This of course does not exist, but is there anything similar in anyway?
Thanks.
I've always just used a thumbnail to link to my Facebook Fan Page and a Like button for individual content. But I'd like to combine the two into one button so that it shows the number of people who have Liked my website next to a button which takes them directly to my Fan Page. SlickDeals does exactly what I'm looking for here (top left corner): http://archive.slickdeals.net/ Any idea on how I can do this too?
I think the slickdeals fan status is a proprietary customization - simple one indeed. You might try to mimic their code.
<img src="http://st.slickdealz.net/images/iconrepo/social2/16px/facebook.png" width="16" height="16">
<img src="http://st.slickdealz.net/images/iconrepo/social2/16px/facebook.png" width="16" height="16">
<span class="triangle-border" title="82,851 Fans">83K</span>
However, Facebook provides a plugin to create Like buttons http://developers.facebook.com/docs/reference/plugins/like/ that is much more powerful and easier.