Error message

The spam filter installed on this site is currently unavailable. Per site policy, we are unable to accept new submissions until that problem is resolved. Please try resubmitting the form in a couple of minutes.

Add Twitter and Facebook buttons to your blog posts

  • Posted on: 2 November 2011
  • By: Pradeep George

There are several ways you can add the Twitter and Facebook buttons to your blog posts so that people can easily share your artciles or blog posts. One of the easiest way to add the following php code in to your page.

1. In Drupal, make sure you have enabled "PHP filter" in your module section.
2. Create a new block for Twitter and Facebook section
3. Add the below php code in the body as "Source" in case you have wysiwyg editor enabled
4. Select the Text format as "PHP code"
5. Save and add the block in your blog section.

Have a great time blogging!

<div class="share-this"> <a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal">Tweet</a> <script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script> <div class="facebook-share-button"> <iframe src="http://www.facebook.com/plugins/like.php?href='. urlencode(get_permalink($post->ID)) .'&amp;layout=button_count&amp;show_faces=false&amp;width=200&amp;action=like&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:200px; height:21px;" allowTransparency="true"></iframe> </div> </div>

Category: 

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.