Tweet button and Google “+1” button added

Tweet and Google “+1” buttons were added under every post on this blog. Once again I appreciated the Thematic Framework and the whole concept of child-themes. Thanks to it, putting the buttons on the bottom of each post meant just creating two simple functions in functions.php file of the child-theme.

I decided to publish the code here, because even though it’s quite easy, it still took me some time to figure it out. I hope it will help someone at least a little.

function mytheme_share($content)
$tweetbutton = '<a href="" class="twitter-share-button" data-url="' . get_permalink() .'" data-text=" ' . get_the_title() .'" data-count="horizontal" data-via="ok1cld">Tweet</a><script type="text/javascript" src=""></script>';
$plusone = '<g:plusone href="' . get_permalink() .'"></g:plusone>';
$content .= "<p>" . $tweetbutton . $plusone . "</p>";
return $content;
add_filter('the_content', 'mytheme_share', 0);

function mytheme_plusone_js()
{ ?>
<script type="text/javascript" src=""></script>
<?php }
add_action('thematic_after', 'mytheme_plusone_js');

For more information how to add Tweet button to your webpage see and if you wanna know how to add “+1” look at

This entry was posted in General and tagged , , . Bookmark the permalink. Both comments and trackbacks are currently closed.