Quantcast
Viewing all articles
Browse latest Browse all 10

Share buttons in wordpress without wordpress plugin

http://wordpressapi.com/2011/03/19/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.

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

Image may be NSFW.
Clik here to view.

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

<div id="sharebox" style="">

<div>
<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.

How to Add the social Bookmar Icons in WordPress theme without wordpress plugins

Incoming search terms:

Follow us on Twitter WordPress API


Viewing all articles
Browse latest Browse all 10

Trending Articles