Every time you want to increase your traffic you must think about the social networking sites. There are plenty of social networking sites but few of them will be helpful for your website if it is used in effective manner. Twitter and Facebook must be pointed out to make this shortlist.
Few days back I wrote about How to: Add Social icons to every post without using plugin by what you can add buttons of digg, stumbleupon, reddit, facebook buttons.
But here I’m writiing how you can add “Share on Facebook” button in your WordPress blog to make facebook very special. Just follow the simple steps below to do so:
1. Open the single.php file from your theme directory.
2. Add the following code in the loop:
<a href=”http://www.facebook.com/sharer.php?u=<?php the_permalink();?>&t=<?php the_title(); ?>” target=”blank”>Share on Facebook</a>
3. Alternatively you can use getTinyUrl() function to send a short URL to Facebook:
<?php $turl = getTinyUrl(get_permalink($post->ID)); ?>
<a href=”http://www.facebook.com/sharer.php?u=<?php echo $turl;?>&t=<?php the_title(); ?>” target=”blank”>Share on Facebook</a>
4. You are done!
Now your readers are able to share your posts to Facebook.
Thanks to Smashing Magazine for this awesome tutorial.
Related posts:
- WordPress Tutorial: Add Social icons to every post without using plugin We all know the importance of social networks in...
- How to: Display Thumbnail Recent Posts in WordPress Related posts are very useful for both your readers...
- How to: Show both excerpt and full post on homepage How you are displaying your post in the homepage...




Share




{ 1 trackback }
{ 0 comments… add one now }