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.
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>
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.