Add twitter and facebook buttons to your blog posts

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>

Add twitter and facebook buttons to your blog posts

Leave a Reply

Your email address will not be published. Required fields are marked *