Skip to content
  • Home
  • Blog
    • yttags
    • Youtube
  • Categories
  • Tools
  • Server-Side
    • php
    • Node.js
    • ASP.NET
    • Magento
    • Codeigniter
    • Laravel
    • Yii
  • JS
    • AngularJS
    • Ajax
    • VueJs
    • jQuery
    • ReactJS
    • JavaScript
  • Full Form
  • Guest Post
  • Advertise
  • About
  • Contact Us
Pakainfo

Pakainfo

Web Development & Good Online education

how to Social Media Sharing Buttons in php?

November 19, 2020 Pakainfo php, JavaScript, jQuery, Programming Leave a comment
1.5/5 - (40 votes)

In this Post we will show you how to share your page or website in Social Media Sharing Buttons using php. This post we will share ,link on social media with title and url using php.

we will share Buffer, diggit, Email, Facebook, Google+, LinkedIn, Pinterest, Print, Reddit, StumbleUpon, Tumblr, Twitter, vkontakte and Yummly social media with php code.

For use this code of share button on social media, we have to pass url and title of url and pass in to give method of social media tab.

For use this code pass your site url and title in given variable $site_url and $site_title.

Free Live Chat for Any Issue

Social Media Sharing Buttons using php

CSS Code

#social_media_sharing_buttons img {
width: 36px;
box-shadow: 0;
padding: 6px;
display: inline;
border: 0;
}

Pass your url and title in variable

HTML & PHP Code

<?php 
    // pass web-site url
    $site_url  = "http://www.pakainfo.com/blog";
    // post title
    $site_title  = "pakainfo";
?>

<!-- <a> tab for http://www.pakainfo.com/blog share link for social media -->
<div id="social_media_sharing_buttons">
    
    <!-- Online Buffer Social Media -->
    <a href="https://bufferapp.com/add?url=<?=$site_url?>&text=<?=$site_title?>" target="_blank">
        <img src="http://www.pakainfo.com/example/images/buffer.png" alt="Buffer share link" />
    </a>
    
    <!-- Online Digg Social Media -->
    <a href="http://www.digg.com/submit?url=<?=$site_url?>" target="_blank">
        <img src="http://www.pakainfo.com/example/images/diggit.png" alt="Digg  share link" />
    </a>
    
    <!-- Online Email Social Media -->
    <a href="mailto:?Subject=<?=$site_title?>&Body=I%20saw%20this%20and%20thought%20of%20you!%20 <?=$site_url?>">
        <img src="http://www.pakainfo.com/example/images/email.png" alt="Email share link" />
    </a>
 
    <!-- Online Facebook Social Media -->
    <a href="http://www.facebook.com/sharer.php?u=<?=$site_url?>" target="_blank">
        <img src="http://www.pakainfo.com/example/images/facebook.png" alt="Facebook share link" />
    </a>
    
    <!-- Online Google+ Social Media -->
    <a href="https://plus.google.com/share?url=<?=$site_url?>" target="_blank">
        <img src="http://www.pakainfo.com/example/images/google.png" alt="Google share link" />
    </a>
    
    <!-- Online LinkedIn Social Media -->
    <a href="http://www.linkedin.com/shareArticle?mini=true&url=<?=$site_url?>" target="_blank">
        <img src="http://www.pakainfo.com/example/images/linkedin.png" alt="LinkedIn share link" />
    </a>
    
    <!-- Online Pinterest Social Media -->
    <a href="javascript:void((function()%7Bvar%20e=document.createElement('script');e.setAttribute('type','text/javascript');e.setAttribute('charset','UTF-8');e.setAttribute('src','http://assets.pinterest.com/js/pinmarklet.js?r='+Math.random()*99999999);document.body.appendChild(e)%7D)());">
        <img src="http://www.pakainfo.com/example/images/pinterest.png" alt="Pinterest share link" />
    </a>
    
    <!-- Print Social Media -->
    <a href="javascript:;" onclick="window.print()">
        <img src="http://www.pakainfo.com/example/images/print.png" alt="Print share link" />
    </a>
    
    <!-- Online Reddit Social Media -->
    <a href="http://reddit.com/submit?url=<?=$site_url?>&title=<?=$site_title?>" target="_blank">
        <img src="http://www.pakainfo.com/example/images/reddit.png" alt="Reddit share link" />
    </a>
    
    <!-- Online StumbleUpon Social Media -->
    <a href="http://www.stumbleupon.com/submit?url=<?=$site_url?>&title=<?=$site_title?>" target="_blank">
        <img src="http://www.pakainfo.com/example/images/stumbleupon.png" alt="StumbleUpon share link" />
    </a>
    
    <!-- Online Tumblr Social Media -->
    <a href="http://www.tumblr.com/share/link?url=<?=$site_url?>&title=<?=$site_title?>" target="_blank">
        <img src="http://www.pakainfo.com/example/images/tumblr.png" alt="Tumblr share link" />
    </a>
     
    <!-- Online Twitter Social Media -->
    <a href="https://twitter.com/share?url=<?=$site_url?>&text=Simple%20Share%20Buttons&hashtags=simplesharebuttons" target="_blank">
        <img src="http://www.pakainfo.com/example/images/twitter.png" alt="Twitter share link" />
    </a>
    
    <!-- Online vkontakte Social Media -->
    <a href="http://vkontakte.ru/share.php?url=<?=$site_url?>" target="_blank">
        <img src="http://www.pakainfo.com/example/images/vk.png" alt="VK share link" />
    </a>
    
    <!-- Online Yummly Social Media -->
    <a href="http://www.yummly.com/urb/verify?url=<?=$site_url?>&title=<?=$site_title?>" target="_blank">
        <img src="http://www.pakainfo.com/example/images/yummly.png" alt="Yummly share link" />
    </a>

</div>

index.html

<!DOCTYPE html>
<html>
<head>
<title>How To Style Social Media Buttons - www.pakainfo.com</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<style>
.fa {
  padding: 20px;
  font-size: 30px;
  width: 50px;
  text-align: center;
  text-decoration: none;
  margin: 5px 2px;
}

.fa:hover {
    opacity: 0.7;
}

.fa-facebook {
  background: #3B5998;
  color: white;
}

.fa-twitter {
  background: #55ACEE;
  color: white;
}

.fa-google {
  background: #dd4b39;
  color: white;
}

.fa-linkedin {
  background: #007bb5;
  color: white;
}

.fa-youtube {
  background: #bb0000;
  color: white;
}

.fa-instagram {
  background: #125688;
  color: white;
}

.fa-pinterest {
  background: #cb2027;
  color: white;
}

.fa-snapchat-ghost {
  background: #fffc00;
  color: white;
  text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black;
}

.fa-skype {
  background: #00aff0;
  color: white;
}

.fa-android {
  background: #a4c639;
  color: white;
}

.fa-dribbble {
  background: #ea4c89;
  color: white;
}

.fa-vimeo {
  background: #45bbff;
  color: white;
}

.fa-tumblr {
  background: #2c4762;
  color: white;
}

.fa-vine {
  background: #00b489;
  color: white;
}

.fa-foursquare {
  background: #45bbff;
  color: white;
}

.fa-stumbleupon {
  background: #eb4924;
  color: white;
}

.fa-flickr {
  background: #f40083;
  color: white;
}

.fa-yahoo {
  background: #430297;
  color: white;
}

.fa-soundcloud {
  background: #ff5500;
  color: white;
}

.fa-reddit {
  background: #ff5700;
  color: white;
}

.fa-rss {
  background: #ff6600;
  color: white;
}
</style>
</head>
<body>

<h2>Style Social Media Buttons - www.pakainfo.com</h2>
<a href="#" class="fa fa-rss"></a>
<a href="#" class="fa fa-vine"></a>
<a href="#" class="fa fa-skype"></a>
<a href="#" class="fa fa-yahoo"></a>
<a href="#" class="fa fa-vimeo"></a>
<a href="#" class="fa fa-tumblr"></a>
<a href="#" class="fa fa-flickr"></a>
<a href="#" class="fa fa-reddit"></a>
<a href="#" class="fa fa-google"></a>
<a href="#" class="fa fa-android"></a>
<a href="#" class="fa fa-youtube"></a>
<a href="#" class="fa fa-twitter"></a>
<a href="#" class="fa fa-dribbble"></a>
<a href="#" class="fa fa-linkedin"></a>
<a href="#" class="fa fa-facebook"></a>
<a href="#" class="fa fa-instagram"></a>
<a href="#" class="fa fa-pinterest"></a>
<a href="#" class="fa fa-foursquare"></a>
<a href="#" class="fa fa-stumbleupon"></a>
<a href="#" class="fa fa-snapchat-ghost"></a>
      
</body>
</html> 

Download

I hope you get an idea about social share php code.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Read Also:  Frontaccounting API - Frontaccounting documentation - Frontaccounting tutorial

Related posts:

  1. How to Create Social Media Buttons for All the Top Social Networks
  2. Sticky Social Media Floating Sidebar html
  3. How To Create Social Media icons footer using bootstrap?
  4. How to Guide on Scraping Social Media Data with PHP?
  5. Previous and next buttons functionality in javascript
  6. How to Show and Hide div elements using radio buttons?
  7. Social Integration with Facebook Twitter and Google using PHP
  8. bootstrap 4 multiple image slider with thumbnail navigation
  9. Laravel Global variable Sharing Data with all views
  10. Top 10 Great Cloud Storage File Sharing Services
Read Also:  laravel shopping cart - Best 7 Steps to Add to Cart and Checkout Code in Laravel
facebook share button code for websiteHow To Style Social Media Buttonshtml code for social media iconsjquery social share buttons plugin free downloadshare button generatorsocial media icons html generatorsocial media share scriptSocial Media Sharingsocial share buttons htmlsocial share php code

Post navigation

Previous Post:how to open wordpress dashboard in localhost xampp?
Next Post:Resolving the CodeIgniter “No Input File Specified” Error

Search

Write For Us

We’re accepting well-written informative guest posts and this is a great opportunity to collaborate.
Submit a guest post to [email protected]
Contact Us

Freelance web developer

Do you want to build a modern, lightweight, responsive website quickly?
Need a Website Or Web Application Contact : [email protected]
Note: Paid Service
Contact Me
Cricday

Categories

3movierulz (48) Ajax (464) AngularJS (377) ASP.NET (61) Bollywood (92) Codeigniter (174) CSS (96) Earn Money (61) Education (53) Entertainment (108) fullform (77) Google Adsense (62) Highcharts (77) Hollywood (93) JavaScript (1354) Jobs (39) jQuery (1421) Laravel (1083) LifeStyle (50) movierulz4 (47) Mysql (1029) Mysqli (890) Node.js (38) php (2110) Programming (2320) Python (96) ReactJS (37) Software (102) Software (77) Stories (78) tamilrockers (88) Tamilrockers kannada (48) Tamilrockers telugu (47) Tech (101) Technology (2359) Tips and Tricks (107) Tools (111) Top10 (293) Trading (49) Trending (45) VueJs (250) Web Technology (83) webtools (129) wordpress (165) World (121)

Advertise With Us

Increase visibility and sales with advertising. Let us promote you online.
Click Here

A To Z Full Forms

Access a complete full forms list with the meaning, definition, and example of the acronym or abbreviation.
Click Here

Web Development & Good Online education : Pakainfo by Pakainfo.
Top
Subscribe On YouTube : Download Source Code & New itsolutionstuck
We accept paid guest Posting on our Site : Guest Post Chat with Us On WhatsApp