Share buttons in wordpress without wordpress plugin

I don’t recommend you to use wordpress plugin for adding the share buttons. we have simple code for add Share buttons in wordpress without wordpress plugin

Share buttons in wordpress without wordpress plugin

There are many wordpress plugins available for adding share button in wordpress or any website. I don’t recommend you to use the wordpress plugin for adding the share buttons like, facebook, twitter, linkedin, stumbleupon, delicious and Google buzz. Because when you install wordpress plugin for social buttons then that plugin will use your database and on every page view that will fire query to your database and your page view will became little bit slower. If you are having less visitors then this ok but if your site is having large visitors than you need to think about small issues also. Floating share button are very popular these days. You can easily add the sharebox which floating bar. Using following code you can add the share buttons without wordpress plugin.

I written some code for this and on my site share buttons are looking as follows:

Share buttons in wordpress without wordpress plugin
Share buttons in wordpress without wordpress plugin

I created file called sharebox.php and in that file just written following code.

<div id="sharebox" style="">
<a href="http://twitter.com/share" data-count="vertical" data-via="digcms">
Tweet</a>
<script type="text/javascript" src="http://platform.twitter.com/widgets.js">
</script>
</div>
<div>
<script>var fbShare = {url: <?php the_permalink() ?>,size: 'large',badge_text: 'fff',badge_color: '3b5998',google_analytics: 'true'}</script>
<script src="http://widgets.fbshare.me/files/fbshare.js"></script>
</div><div>
<script src="http://www.stumbleupon.com/hostedbadge.php?s=5"></script>
</div>
<div><a class='delicious-button'  href='http://delicious.com/save'> <!-- { url:"<?php the_permalink() ?>" ,title:"<?php the_title() ?>" } --> Save on Delicious</a></div><div style="display:none;">

<script type="text/javascript">(function() {var s = document.createElement('SCRIPT'), s1 = document.getElementsByTagName('SCRIPT')[0];s.type = 'text/javascript';s.async = true;s.src = 'http://widgets.digg.com/buttons.js';s1.parentNode.insertBefore(s, s1);})();</script><a></a>

</div>

<div><a title="Post on Google Buzz" href="http://www.google.com/buzz/post" data-button-style="normal-count"></a>
<script type="text/javascript" src="http://www.google.com/buzz/api/button.js"></script>

</div><div><script type="text/javascript" src="http://platform.linkedin.com/in.js"></script>
<script type="in/share" data-counter="top"></script></div></div>

After creating sharebox.php file, open your single.php file and put following code in that file.

<?php include 'sharebox.php'; ?>

After that open your style.css file and put following code in that file.

#sharebox{display: block;margin-left: -85px;
position: fixed;top:105px;width:65px;
border:#ccc 1px solid;padding:2px}

If you need more buttons then you should prefer following article. In this article you will find the all the share button code. and you dont need to add any wordpress plugin for adding share or like buttons in wordpress site.

Please write comment for our article: Share buttons in wordpress without wordpress plugin

Add the social Bookmark Icons in WordPress theme without plugins

Published by

Purab

I am Purab from India, Software development is my profession and teaching is my passion. Programmers blog dedicated to the JAVA, Python, PHP, DevOps and Opensource Frameworks. Purab's Github Repo Youtube Chanel Video Tutorials Connect to on LinkedIn

7 thoughts on “Share buttons in wordpress without wordpress plugin”

  1. Hi! I found your post and I really would like to use this. However, I am a newbie WP person, and don’t really know what you mean by this. Can this code be added to a widget in the sidebar? Or, what do you mean by creating a file called “sharebox”? I need help! This is one of the most difficult thing I have tried to find — a cool set of icons and how to use them. How did you put the ones at the top of your page on here? Any more help would be so appreciated! Thanks so much!

    1. you can find free icon set on internet or you easily download the buttons on right click on my top icons. I am saying create sharebox.php file in wordpress theme folder. This tutorial I given for single page sidebar share buttons. For top bar you can search in my site.

  2. Hii Need A Help On This Topic After Creating Sharebox.php how to upload that file in theme?

    Should i backup my theme and include sharebox file in that backup file and reupload or i can directly upload only sharebox file i am new to wordpress don’t know much but need to add these buttons..

    Please Reply Me

Leave a Reply

Your email address will not be published.