In some website pages there was available “Share on Facebook” links. Links that are popular this allows the user to display any posts snippets, news, or articles a blog / website at the Facebook account.

How do you include this feature to your website? This is the trick :
1. Put the code / script in the single.php file, post.php, or other files that have the function to show of any posts or article on the blog/website.
<script type=”"text/javascript”">function fbs_click()
{
u=location.href;
t=document.title;
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 href=”http://www.facebook.com/share.php?u=place_url_here” onclick=”return fbs_click()” target=”_blank”>
<img src=” share-on-facebook.jpg” alt=”Share On Facebook” align=”left”/>
</a>
<?php echo ”
<a href=”http://www.addthis.com/bookmark.php?pub=website_name&url=”.get_permalink().”&title=”.get_the_title($id).”” title=”Bookmark and Share” target=”_blank”><img src=”http://s7.addthis.com/button1-share.gif” width=”125” height=”16” border=”0” alt=”Bookmark and Share” align=”right” /></a>”?>
2. Note the letter “place_url_here”. Replace the letter with a URL address you will share in Facebook. Replace “website_name” with the name of the site.
3. In order you do not need to type the link on each web page, replace the “place_url_here” with functions that can generate or return the URL of each post. For example, if you’re using a WordPress blog, replace with <? Php the_permalink ();?>.
Source: PcPlus














No comments yet.