I want to embed the twitter share option and the code I get is the javascript as well as this link to share:
<a href="https://twitter.com/share" class="twitter-share-button" data-text="Check out this link please" data-via="ObiWanKobi" data-related="User">Tweet</a>
I want the data text and all that to show BUT I want to use my own custom icon and not the twitter icon. So I took away the class="twitter-share-button"
because that is what displays this button but once I do that then the data-text
is lost and it just shares the link. How does one hack this to show a custom icon?
Your help = greatly appreciated
Simplest way to do this is by not using their JavaScript at all, and simply building the share URL yourself:
http://twitter.com/share?text={…}&url={…}
Don’t forget to URL-encode parameter values you put in there properly.
You might want to add a target="_blank"
to the link to open this in a new window/tab, or even add window.open
to optionally open it in a popup with a predefined width and height.
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