Add Social Media Sharing Buttons to Your Blog in Easy Way

Discussion in 'Blogging' started by sagargholap, Oct 5, 2010.

  1. #1
    If you don't yet have added social sharing buttons under your posts, then do it at your earliest convenience because you have already lost a heck of traffic you would have got using social media.

    To make things easier, below is the code you just need to put in your single.php file in wordpress. For more exposure and possibilities of readers sharing your post, add this code both before the post as well as after the post.

    For before the post add the code anywhere after
    <div class="post-title">
    PHP:
    . Adjust the position of the buttons as per your choice.

    For placing the buttons after the post, add the code after

    <div class="entry"><?php the_content('more...'); ?><div class="clear"></div>
    PHP:
    The above placements may differ in different themes. Just look for something like post title and entry in your single.php file.

    Here is the code for the buttons -

    <center>
    <table cellpadding=0 cellspacing=7 border=0 style="margin:0; padding:0;"><p><h2>Liked the post? Share it with your friends</p></h2><tr>
    <div class="clear"></div>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp
    
    
    <td valign="top">
    <a href="http://twitter.com/share" class="twitter-share-button" data-count="vertical">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp</td>
    
    
    <td valign="top">
    
    <a href="http://www.delicious.com/save" onclick="window.open('http://www.delicious.com/save?v=5&noui&jump=close&url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title), 'delicious','toolbar=no,width=550,height=550'); return false;"><img src="http://img827.imageshack.us/img827/2932/deliciousb.png" alt="Delicious" title="Save on Delicious" /></a>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp</td>
    
    <td valign="top">
    <script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"></script>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp</td>
    
    <td valign="top">
    <a name="fb_share" type="box_count" href="http://www.facebook.com/sharer.php">Share</a><script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp</td>
    
    <td valign="top">
    <script src="http://www.stumbleupon.com/hostedbadge.php?s=5"></script>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp</td>
    
    <td valign="top">
    <?php if(function_exists('wp_email')) { email_link(); } ?>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp</td>
    
    <td valign="top">
    <a class="DiggThisButton DiggMedium"></a
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp</td> 
    
    
    </tr>
    </table>
    </center>
    Code (markup):

    With the above code, all the buttons will be aligned in one single line which looks good.


    Thanks!:) I hope it was helpful for you.


    Regards,
    Sagar Gholap
    http://www.aspiredtechie.com
     
    sagargholap, Oct 5, 2010 IP
  2. choirul

    choirul Peon

    Messages:
    20
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    choirul, Oct 5, 2010 IP
  3. sagargholap

    sagargholap Active Member

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    56
    #3
    Using plugins is the easiest way to do any changes, but using many plugins might slow down your blog and use to much resources on a shared hosting which could be the reason for suspension. So considering everything, its better to go with this.

    What you say?


    Regards,
    Sagar Gholap
    sagar@aspiredtechie.com
     
    sagargholap, Oct 6, 2010 IP