Skip to content

Instantly share code, notes, and snippets.

@iamrobert
Created July 16, 2016 09:29
Show Gist options
  • Save iamrobert/2077adc6c67daa7b060d4a46083774ae to your computer and use it in GitHub Desktop.
Save iamrobert/2077adc6c67daa7b060d4a46083774ae to your computer and use it in GitHub Desktop.
JOOMLA SOCIAL SHARE BUTTONS
// Create social links in Joomla template or in FLEXIcontent items:
<?php
//GET CURRENT PAGE URL - need to urlencode;
$social_link = urlencode(JURI::current());
//GET CURRENT PAGE TITLE - need to urlencode;
$doc = JFactory::getDocument();
$page_title = urlencode($doc->getTitle());
//GET META DESCRIPTON
$meta_description = urlencode($doc->getMetaData("description"));
?>
<ul class="share-buttons">
<li><a href="https://www.facebook.com/sharer/sharer.php?u=<?php echo $social_link;?>&amp;t=<?php echo $page_title;?>" title="Share on Facebook" target="_blank">FB</a></li>
<li><a href="https://twitter.com/intent/tweet?source=<?php echo $social_link;?>&amp;text=<?php echo $page_title;?>:%20<?php echo $social_link;?>" target="_blank" title="Tweet">TWITTER</a></li>
<li><a href="http://www.linkedin.com/shareArticle?mini=true&amp;url=<?php echo $social_link;?>&amp;title=<?php echo $page_title;?>&amp;summary=<?php echo $meta_description;?>&amp;source=<?php echo $social_link;?>" target="_blank" title="Share on LinkedIn">LINKEDIN</a></li>
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment