was successfully added to your cart.

Add Facebook and Twitter “Share” Buttons to Your WordPress Blog

By December 6, 2015 Our Blog No Comments

Social bookmarking buttons are essential for any blog these days. They are vital to helping people share content that they find useful and interesting. And with WordPress of course, you have a lot of plugins to help you add social sharing buttons to your site. However, many of these plugins either use Javascript, or a whole host of external references, which are a burden on your server and really slow down your site load time.

As title mentions in this tutorial we will go over steps on how to set up Facebook and Twitter buttons on your blog without using any plugins.

Go to your theme’s single.php file and paste below code after template tag „the_content()“ . This will add sharing button at the bottom of the post

[code] <div class="sharebuttons">
<a href="http://www.facebook.com/sharer.php?u=<?php echo urlencode(get_permalink($post->ID)); ?>&t=<?php echo rawurlencode(get_the_title()); ?>" target="_blank">Post this article in Facebook posten</a>
<a href="http://twitter.com/home?status=<?php echo rawurlencode(get_the_title()); ?> - <?php echo urlencode(get_permalink($post->ID)); ?>" target="_blank" title="Tweet this article">Tweet this article</a>
<a href="mailto:?subject=Artikel auf <?php echo rawurlencode(get_bloginfo('url')); ?>: <?php echo rawurlencode(get_the_title()); ?>&body=<?php echo urlencode(get_permalink($post->ID)); ?>" title="Send article via mail">Send article via mail</a>
</div><!-- .sharebuttons" -->


Open style.css file of your WordPress theme and put below code for better styling.

[code] /*Sharebuttons*/
.sharebuttons {
margin: 15px 0;
clear: both;
.sharebuttons a {
padding: 5px;
background: #ddd;
border: 1px solid #333;
text-decoration: none;

Your result will be like this


Leave a Reply

Click to Get Full Access to our entire collection for only $69! Get Access Today