How-To PHP

How to make a Social Sharer in PHP

Nowadays, social media sharing is required for any web-related projects. Some advantages of social media sharing are :

  • Reduced in marketing costs.
  • Increased in sales.
  • Increased traffic to your website.
  • Improved ranking on search engines.

There are so many free and easy-to-implement services out there. But all those social sharing plugins are used a lot of JavaScript which is increases page load time and it results in poor user experience. So, if you want to customize the social sharing button as per your project theme and load the page faster, then it will be a good idea to use social share buttons with custom links and custom CSS for your sharer buttons.

 

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<div class="socialShare">
<a href="https://plus.google.com/share?url=<?php echo $_SERVER[HTTP_HOST] . $_SERVER[REQUEST_URI]; ?>" target="_blank" class="share-btn google-plus">
<i class="fa fa-google-plus"></i></a>
><a href="https://www.facebook.com/sharer.php?u=<?php echo $_SERVER[HTTP_HOST] . $_SERVER[REQUEST_URI];  ?> " target="_blank" class="share-btn facebook">
<i class="fa fa-facebook"></i></a>
<a href="http://www.linkedin.com/shareArticle?url=<?php echo $_SERVER[HTTP_HOST] . $_SERVER[REQUEST_URI]; ?>" target="_blank" class="share-btn linkedin">
<i class="fa fa-linkedin" style="margin-left:5px;"></i></a>
</div>

 

About the author

Chetan Hegde

Chetan Hegde

Chetan Hegde is the architect of ProCodersOnline.com. I'm a Software Engineer and technology enthusiast person who loves to learn and explore new things and technologies. When i'm not writing content for my websites, I love to travel and explore the nature.

Add Comment

Click here to post a comment