Social share without plugin for wordpress

function share_buttons(){ $title=get_the_title(); $link=str_replace(" ","%20",get_the_permalink()); $twitterURL = 'https://twitter.com/intent/tweet?text='.$title.'&url='.$link; $facebookURL = 'https://www.facebook.com/sharer/sharer.php?u='.$link; $googleURL = 'https://plus.google.com/share?url='.$link; $linkedinURL='http://www.linkedin.com/shareArticle?mini=true&url='.$link.'&title='.$title; $html='<div class="social-links"> <span>Share on :</span> <div class="links"> <a href="'.$facebookURL.'">Facebook</i></a> <a href="'.$twitterURL.'">Twitter</i></a> <a href="'.$googleURL.'">Google Plus</i></a> <a href="'.$linkedinURL.'">Linkedin</i></a> </div> </div>'; return $html; }
Social share without plugin for wordpress

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.