function wpvkp_social_buttons($content) {
global $post;
if(is_singular() || is_home()){
// Get current page URL
$sb_url = urlencode(get_permalink());
// Get current page title
$sb_title = str_replace( ‘ ‘, ‘%20’, get_the_title());
// Construct sharing URL without using any script
$twitterURL = ‘https://twitter.com/intent/tweet?text=’.$sb_title.’&url=’.$sb_url.’&via=wpvkp’;
$facebookURL = ‘https://www.facebook.com/sharer/sharer.php?u=’.$sb_url;
$linkedInURL = ‘https://www.linkedin.com/shareArticle?mini=true&url=’.$sb_url.’&title=’.$sb_title;
$gplusURL =’https://plus.google.com/share?url=’.$sb_url.”;
// Add sharing button at the end of page/page content
$content .= ‘
‘;
return $content;
}else{
// if not a post/page then don’t include sharing button
return $content;
}
};
// Enable the_content if you want to automatically show social buttons below your post.
//add_filter( ‘the_content’, ‘wpvkp_social_buttons’);
Facebook
Twitter
Linkedin
Google+