HTML Twitter & Facebook Links

Let’s say you wanted to make a link somewhere on your site for Facebook and Twitter share buttons, but you wanted to control the url, the title, and the message being shared – Here is some example code on how to do just that:

Share this on Facebook

<a href="http://www.facebook.com/sharer.php?s=100&amp;p[title]=Put Your Title Here&amp;p[summary]=Put Your Message Text Here.&amp;p[url]=http://www.yoururl.com/"><img style="vertical-align: -10px;" src="http://cookefamily.us/wp-content/uploads/2012/03/facebook.png" alt="" /><span style="color: black; font-size: 14px;"> Share this on Facebook</span></a>
									

Share this on Twitter

<a style="text-decoration: none;" href="https://twitter.com/share?text=Put The Text You Want in Your Tweet Here @ReplyName : &amp;url=http://yoururlhere/" target="new"><img style="vertical-align: -10px;" src="http://cookefamily.us/wp-content/uploads/2012/03/twitter.png" alt="" /><span style="color: black; font-size: 14px;"> Share this on Twitter</span></a>
									

I would typically use this code on a landing page or product page with links back to that specific page and a blurb about the person, site, product. Icons and text for the links can be changed as well as the messages you use inside Facebook and Twitter.

Example 1:

Example 2:

Facebook:

Twitter:

Leave a Reply