Sociable Widget in WordPress

I use the Sociable plugin on a couple of the blogs I look after and was surprised to see that there is no sidebar widget. That means that if you want to add social icons to your home page and that features a few different posts, essentially you can’t.

After looking at this a few different ways I managed to pick out the code from the plugin and adapt it to be used in a text Widget. The code is as follows with the things to change shown in blue: –

[code]

<div class=’sociable’ style=’float:none’>
<ul class=’clearfix’>
<li id=”Facebook_Counter”>
<iframe src=”http://www.facebook.com/plugins/like.php?href=http://www.yoursite.com/yourpageifany/&send=false&layout=button_count&show_faces=false
&action=like&colorscheme=light&font” scrolling=”no” frameborder=”0″ style=”border:none; overflow:hidden;height:32px;width:100px” allowTransparency=”true”></iframe>
</li>
<li id=”Twitter_Counter”>
<a href=”https://twitter.com/share” data-text=”Your Site/Page – http://www.yoursite.com/yourpageifany/” data-url=”http://www.yoursite.com/yourpageifany/” class=”twitter-share-button” data-count=”horizontal”>Tweet</a><script type=”text/javascript” src=”//platform.twitter.com/widgets.js”></script></li>
</ul>
<ul>
<li id=”LinkedIn_Counter”><script src=”http://platform.linkedin.com/in.js” type=”text/javascript”></script><script type=”IN/Share” data-url=”http://www.yoursite.com/yourpageifany/” data-counter=”right”></script></li>
<li id=”Google_p”><g:plusone annotation=”bubble” href=”http://www.yoursite.com/yourpageifany/” size=”medium”></g:plusone></li>
</ul>
&nbsp
</div><!– End Sociable –>

[/code]

The green highlight was because the row of icons can’t display across the sidebar so tends to go all over. You can modify this by closing one unordered list (ul) and opening another.If you include a lot of icons just repeat this.

I should add at this point that this is for the big 4! Facebook, Google, LinkedIn and Google+. If you include more you will need to view the code of a page with the Social plugin on it, search for sociable then copy the code and change the page details.

Once you have your code sorted out, just go to your WordPress Widgets area, add a text widget and paste your code in. With any luck it should all flow in and include the correct number of likes etc for the page.

Leave a Reply

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