Create your own Social Sharing Button Links

More
2 years 2 days ago - 2 years 2 days ago #63231 by iamrobert
I wanted to create my own simple sharing buttons - so I can share the URL via FB/Twitter or Linked In. Addthis was a bit heavy for this site's requirements - and didn't see any tutorial anywhere for Joomla.

This code can be used in either FLEXIcontent item template or your own Joomla Template
  <?php 
//GET CURRENT PAGE URL - need to urlencode;
$social_link = urlencode(JURI::current()); 
//GET CURRENT PAGE TITLE - need to rawurlencode;
$doc = JFactory::getDocument(); 
$page_title = rawurlencode($doc->getTitle());
//GET META DESCRIPTION - need to rawurlencode;
$meta_description = rawurlencode($doc->getMetaData("description")); 
?>

//CODE CAN BE PLACED IN YOUR TEMPLATE
<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>

You can look here for further code:
simplesharingbuttons.com/
Last edit: 2 years 2 days ago by iamrobert.

Please Log in or Create an account to join the conversation.

More
1 year 11 months ago #63310 by bunnachart
You can use module joomla for insert php code like flexi-custom-code
and then create field fc load module hide from both (Front and Back-end) and load that module and go to template drag field to template and save

Please Log in or Create an account to join the conversation.

More
1 year 11 months ago #63328 by micker
thanks for share

FLEXIcontent is Free but involves a very big effort on our part.
Like the our support? (for a bug-free FC, despite being huge extension) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing reviews. Thanks![/size]

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
© 2018 Flexicontent. All Rights Reserved.