How to make “Share on Facebook” Feature on Blog / Website Page

By Iwan
Posted on May 18, 2009
Advertisements

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



FBTW DGRDSUDLBLTCGOMSMX

If you like it, you might consider subscribing to our feed

Or else, you could also bookmark it to your favourite social bookmark sites.


RSS feed | Trackback URI

Comments »

No comments yet.

Name (required)
E-mail (required - never shown publicly)
URI
Your Comment (smaller size | larger size)
You may use <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> in your comment.

Trackback responses to this post

Search terms tagging for this post: facebook gadget for blogspot, mobile facebook share page