Adding Social Media Share Buttons Beside Post Excerpts

Social media has gained significant prominence as a source of traffic. If you look at some of the popular blogs out there, you will find that most of them have a LIKE button and a RETWEET button just beside the post excerpt. If you have been wondering how to do that, here is how you can give your visitors an option to share the content from the homepage itself.

To add a Twitter RETWEET button and a Facebook LIKE button beside the post excerpt on the home page:

1. Log in to your WordPress Admin Panel

2. Navigate to Appearance >> Editor >> Index.php

3. Search for this piece of code :

<div class=”entry”>

4. Once you find it paste the below given code right under it :

<div align=”right”><div id=’twittley_button’ style=’float:right;margin-left:10px;’>
<div id=”fblike”>
<script src=”″></script>
<fb:like href=”<?php echo get_permalink($postid); ?>” layout=”box_count” show_faces=”true” font=””></fb:like></div><br />
<a href=”” class=”twitter-share-button” data-url=”<?php echo get_permalink($postid); ?>” data-text=”
<?php the_title(); ?>” data-count=”vertical” data-via=”YourTwitterID”>Tweet</a>
<script type=”text/javascript” src=””></script>

Note : Don’t forget to change the via – “YourTwitterID” to your own twitter username.

Once done, save the file by clicking on the update file button. That’s it. You have successfully integrated the social sharing buttons on the homepage beside each of the post excerpts.

Speak Your Mind


This site uses Akismet to reduce spam. Learn how your comment data is processed.