I've been searching around the internet for a while now and am unable to find anything that works. I want to use my own custom image for the share button but whenever I try to surround the image the share button disappears. Sorry for lack of information because I'm new to the Facebook SDK. Any help would be greatly appreciated, thanks.
Current code that I have:
<div class="fb-share-button" data-href="https://developers.facebook.com/docs/plugins/" data-layout="button"><img src="Images/Icons/facebook.png" class="link"></div>
right click on the button that you want to change "Inspect element" and find out if it really is an image or a CSS if it's an image find where the image is and upload your file with the same name ontop of the old one or if it's a CSS look for a button generator in google and just paste the code from there.
Facebook used to allow custom parameters in the Facebook share button, but it is not working now. What I need is to create a Facebook share button which will have a custom title, url, image, description, etc. It cannot be done using meta tags because there are multiple share buttons on a single page.
Images in Link Shares 1 The Open Graph meta-tag. The og:image tag can be used to specify the URL of the image that appears when someone shares the content to Facebook. 2 Requirements. The minimum allowed image dimension is 200 x 200 pixels. ... 3 Pre-caching images. ... 4 Updating images. ... 5 Troubleshooting. ...
Pick the URL of a website or Facebook Page you want to share. 2. Code Configurator. Paste the URL to the Code Configurator and adjust the layout of your share button. Click the Get Code button to generate your share button code. 3. Copy & Paste HTML snippet. Copy and past the snippet into the HTML of the destination website.
It appears Facebook just wants us to share entire pages (based on url only). There's also their new share dialog, but even though they claim it can do all of what the old sharer.php could do, that doesn't appear to be true. And here's Facebooks 'best practices' for sharing.
This code works fine for me:
<!-- facebook -->
<img src="[YOUR_FACEBOOK_PIC]" alt="Share on Facebook" onclick="window.open('https://www.facebook.com/sharer/sharer.php?u='+encodeURIComponent('[YOUR_PAGE_URL]'),'facebook-share-dialog','width=626,height=436'); return false;">
<!-- twitter -->
<img src="[YOUR_TWITTER_PIC]" alt="Share on Twitter" onclick="javascript:window.open('https://twitter.com/share?text=[SOME_TEXT_TO_PREPOLUTATE_TWEET]&url=[YOUR_PAGE_URL]','Twitter-dialog','width=626,height=436'); return false;">
<!-- google+ -->
<img src="[YOUR_GOOGLE_PIC]" alt="Share on Google Plus" onclick="window.open('https://plus.google.com/share?url=[YOUR_PAGE_URL]','Google-dialog','width=626,height=436'); return false;">
Just replace the text between brackets, and don't forget to "url encode" all the text that goes in the url to avoid issues.
And it doesn't need the SDK for any of them.
Here are references to the official documentation for each of them:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With