Automatically add Twitter and Facebook buttons to your posts
Automatically add Twitter and Facebook buttons to your posts
Facebook and Twitter are the two most popular social networks, and they can provide lots of traffic to your website. In order to make it easy for people to share your posts on Twitter and Facebook, paste this code into your functions.php file and save it. It will display both Facebook and Twitter buttons, like those you can see at the bottom of this post.
function share_this($content){
if(!is_feed() && !is_home()) {
$content .= ‘
Tweet
‘;
}
return $content;
}
add_action(‘the_content’, ‘share_this’);