Add Share & Bookmark this button to a non-blog website
First of all this solution is addressing to everyone looking to add Share This button to a normal website NOT a WordPress blog or for blogger! Since there are yet hundreds of solutions for blogs it was very hard to find one to apply to a normal website.
The solution is coming from Share this website and it works like a charm on my new Toronto Questions and Answers community website.
All you have to do is to create an account on this website and follow the steps to get the code which you’ll have to implement into your code. The tricky part for me was implementing this code into a PHP dynamic page but after all I did it. What I really like is that this code is sending the title as well to twitter.
How is looking my code:
Header:
Body code (where I wanted the Share this button to appear on the page):
{ if (!empty($q_view['form']))
{
$this->output('<DIV CLASS="qa-q-view-buttons">');
$this->output('<a id="ck_email" class="stbar chicklet" href="javascript:void(0);"><img src="http://w.sharethis.com/chicklets/email.gif" /></a>
<a id="ck_facebook" class="stbar chicklet" href="javascript:void(0);"><img src="http://w.sharethis.com/chicklets/facebook.gif" /></a>
<a id="ck_twitter" class="stbar chicklet" href="javascript:void(0);"><img src="http://w.sharethis.com/chicklets/twitter.gif" /></a>
<a id="ck_sharethis" class="stbar chicklet" href="javascript:void(0);"><img src="http://w.sharethis.com/chicklets/sharethis.gif" /></a>
<script type="text/javascript">
var shared_object = SHARETHIS.addEntry({
title: document.title,
url: document.location.href
});
shared_object.attachButton(document.getElementById("ck_sharethis"));
shared_object.attachChicklet("email", document.getElementById("ck_email"));
shared_object.attachChicklet("facebook", document.getElementById("ck_facebook"));
shared_object.attachChicklet("twitter", document.getElementById("ck_twitter"));
</script>');
$this->output('</DIV>');
}
}
Before Share this I’d tried Tweet meme but with no success. Since Share this is the only one which was entirely working I thought will help other like me trying to implement Tweet me or Share on Facebook sharing buttons on their non-blog websites.
If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.


Adding these buttons make the load time higher. If you are optimizing your website maybe you must load a image before, and load buttons only if user click on it.