Add Facebook Like, Tweet and Google+ in WordPress Without Plugin

By | September 8, 2012

Without using wordpress plugins, we can display social media buttons like facebook, google+ and twitter.All the these codes are available in facebook, google and twitter developer sites. Here i have collected all the codes and giving you as like plugin.

You may ask a question, why i have to use this code and not to use plugins?

  • Excess usage of plugins will increase website loading time.
  • We can easily edit this social media buttons.
Below coding will results and displays like this.
Copy the below coding and paste in post-single.php. Based on theme, filename may vary. If you cant find the filename, just go to  Appearance -> Editor see all file, check whether this function is present the_content(”);. If this function is present, then paste the below code behind the_content(”);

[code type=html]
<!– Facebook like button–>

<iframe src=”http://www.facebook.com/plugins/like.php?href=<?php the_permalink(); ?>
&layout=box_count&show_faces=false&width=450&action=like
&colorscheme=light” scrolling=”no” frameborder=”0″ allowtransparency=”true”
style=”border:none; overflow:hidden; width:54px; height:60px; float:left;”></iframe>

<!– Google + button–>
<div data-size=”tall” data-href=”<?php the_permalink(); ?>”></div>
<script type=”text/javascript”>
(function() {
var po = document.createElement(‘script’); po.type = ‘text/javascript’;
po.async = true;
po.src = ‘https://apis.google.com/js/plusone.js’;
var s = document.getElementsByTagName(‘script’)[0];
s.parentNode.insertBefore(po, s);
})();
</script>

<!– Tweet + button–>

<a href=”https://twitter.com/share”
data-url=”<?php the_permalink(); ?>” data-count=”vertical”>Tweet</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];
if(!d.getElementById(id)){js=d.createElement(s);js.id=id;
js.src=”//platform.twitter.com/widgets.js”
;fjs.parentNode.insertBefore(js,fjs);}}(document,”script”,”twitter-wjs”);</script>

[/code]

Leave a Reply

Your email address will not be published. Required fields are marked *

semipurposive-prealliance