Truemag

  • Categories
    • Tips And Tricks
    • Internet
    • PHP
    • Javascript
    • CSharp
    • SQL Server
    • Linux
  • Lastest Videos
  • Our Demos
  • About
  • Contact
  • Home
  • Write With Us
  • Job Request
Home Internet Share Link/ Url Of Facebook, Twitter, Google Plus, Stumbleupon, Reddit, Digg and Tumblr

Share Link/ Url Of Facebook, Twitter, Google Plus, Stumbleupon, Reddit, Digg and Tumblr

This article just provides share link/url of Facebook, Twitter, Google Plus, Stumbleupon, Reddit, Digg and Tumblr and instruct How to add share link/url of the most popular social media websites in WordPress detail post.

1. List Of Share Link/URL

+ Facebook:
http://www.facebook.com/sharer.php?u=SHARE_URL&t=SHARE_TITLE

+ Twitter:
https://twitter.com/intent/tweet?source=SOURCE&text=SHARE_TITLE&url=SHARE_URL

+ Google Plus:
https://plus.google.com/share?url=SHARE_URL

+ Stumbleupon:
http://www.stumbleupon.com/submit?url=SHARE_URL&title=SHARE_TITLE

+ Reddit:
http://reddit.com/submit?url=SHARE_URL&title=SHARE_TITLE

+ Digg:
http://digg.com/submit?url=SHARE_URL&title=SHARE_TITLE

+ Tumblr:
http://www.tumblr.com/share/link?url=SHARE_URL&name=SHARE_TITLE&description=SHARE_CONTENT

2. Adding Share Link/URL in WordPress Detail Post

First, we need to get post detail information such as: title, link/short link and description by adding PHP code below at the top of the loop-single.php file in your WordPress template folder (after the_post())

<?php
	$post_title = $post->post_title;
	$post_link = get_permalink();
	$post_shortlink = wp_get_shortlink(); 
	$post_excerpt = $post->post_excerpt;	
?>

<?php $post_title = $post->post_title; $post_link = get_permalink(); $post_shortlink = wp_get_shortlink(); $post_excerpt = $post->post_excerpt; ?>

Note: Twitter just allow 140 characters so we just use post’s short link instead full link.

After that, add PHP script below to where you want to place the share hook.

<div class="icon-share">
	<a href="http://www.facebook.com/sharer.php?u=<?php echo urlencode($post_link) ?>&t=<?php echo urlencode($post_title) ?>" target="_blank" title="Let your friends on Facebook know about this" class="fb"></a>
	<a href="https://twitter.com/intent/tweet?source=4rapiddev&text=<?php echo urlencode($post_title) ?>&url=<?php echo urlencode($post_shortlink) ?>" target="_blank" title="Let your followers on Twitter know about this" class="tw"></a>
	<a href="https://plus.google.com/share?url=<?php echo urlencode($post_link) ?>" target="_blank" title="Let your friends on Google Plus know about this" class="gg"></a>
	<a href="http://www.stumbleupon.com/submit?url=<?php echo urlencode($post_link) ?>&title=<?php echo urlencode($post_title) ?>&newcomment=<?php echo urlencode($post_excerpt) ?>" target="_blank" title="Let your friends on Stumbleupon know about this" class="stumblecopon"></a>
	<a href="http://reddit.com/submit?url=<?php echo urlencode($post_link) ?>&title=<?php echo urlencode($post_title) ?>" target="_blank" title="Let your friends on Reddit know about this" class="reddit"></a>
	<a href="http://digg.com/submit?url=<?php echo urlencode($post_link) ?>&amp;title=<?php echo urlencode($post_title) ?>" rev="technology" target="_blank" title="Let your followers on Digg know about this" class="digg"></a>
	<a href="http://www.tumblr.com/share/link?url=<?php echo urlencode($post_link) ?>&name=<?php echo urlencode($post_title) ?>&description=<?php echo urlencode($post_excerpt) ?>" target="_blank" title="Let your friends on Tumblr know about this" class="tumblr"></a>
</div>

<div class="icon-share"> <a href="http://www.facebook.com/sharer.php?u=<?php echo urlencode($post_link) ?>&t=<?php echo urlencode($post_title) ?>" target="_blank" title="Let your friends on Facebook know about this" class="fb"></a> <a href="https://twitter.com/intent/tweet?source=4rapiddev&text=<?php echo urlencode($post_title) ?>&url=<?php echo urlencode($post_shortlink) ?>" target="_blank" title="Let your followers on Twitter know about this" class="tw"></a> <a href="https://plus.google.com/share?url=<?php echo urlencode($post_link) ?>" target="_blank" title="Let your friends on Google Plus know about this" class="gg"></a> <a href="http://www.stumbleupon.com/submit?url=<?php echo urlencode($post_link) ?>&title=<?php echo urlencode($post_title) ?>&newcomment=<?php echo urlencode($post_excerpt) ?>" target="_blank" title="Let your friends on Stumbleupon know about this" class="stumblecopon"></a> <a href="http://reddit.com/submit?url=<?php echo urlencode($post_link) ?>&title=<?php echo urlencode($post_title) ?>" target="_blank" title="Let your friends on Reddit know about this" class="reddit"></a> <a href="http://digg.com/submit?url=<?php echo urlencode($post_link) ?>&amp;title=<?php echo urlencode($post_title) ?>" rev="technology" target="_blank" title="Let your followers on Digg know about this" class="digg"></a> <a href="http://www.tumblr.com/share/link?url=<?php echo urlencode($post_link) ?>&name=<?php echo urlencode($post_title) ?>&description=<?php echo urlencode($post_excerpt) ?>" target="_blank" title="Let your friends on Tumblr know about this" class="tumblr"></a> </div>

Note: you will need to change the style sheet and html to adapt with your current template.

And PHP code above will be render to html similar to this:

<div class="icon-share">
	<a href="http://www.facebook.com/sharer.php?u=http%3A%2F%2F4rapiddev.com%2Finternet%2Fshare-link-url-of-facebook-twitter-google-plus-stumbleupon-reddit-digg-and-tumblr%2F&t=Share+Link%2F+Url+Of+Facebook%2C+Twitter%2C+Google+Plus%2C+Stumbleupon%2C+Reddit%2C+Digg+and+Tumblr" target="_blank" title="Let your friends on Facebook know about this" class="fb"></a>
	<a href="https://twitter.com/intent/tweet?source=4rapiddev&text=Share+Link%2F+Url+Of+Facebook%2C+Twitter%2C+Google+Plus%2C+Stumbleupon%2C+Reddit%2C+Digg+and+Tumblr&url=http%3A%2F%2F4rapiddev.com%2F%3Fp%3D4339" target="_blank" title="Let your followers on Twitter know about this"  class="tw"></a>
	<a href="https://plus.google.com/share?url=http%3A%2F%2F4rapiddev.com%2Finternet%2Fshare-link-url-of-facebook-twitter-google-plus-stumbleupon-reddit-digg-and-tumblr%2F" target="_blank" title="Let your friends on Google Plus know about this" class="gg"></a>
	<a href="http://digg.com/submit?url=http%3A%2F%2F4rapiddev.com%2Finternet%2Fshare-link-url-of-facebook-twitter-google-plus-stumbleupon-reddit-digg-and-tumblr%2F&title=Share+Link%2F+Url+Of+Facebook%2C+Twitter%2C+Google+Plus%2C+Stumbleupon%2C+Reddit%2C+Digg+and+Tumblr" rev="technology" target="_blank" title="Let your followers on Digg know about this" target="_blank" title="Let your friends on Stumbleupon know about this" class="digg"></a>
	<a href="http://www.stumbleupon.com/submit?url=http%3A%2F%2F4rapiddev.com%2Finternet%2Fshare-link-url-of-facebook-twitter-google-plus-stumbleupon-reddit-digg-and-tumblr%2F&title=Share+Link%2F+Url+Of+Facebook%2C+Twitter%2C+Google+Plus%2C+Stumbleupon%2C+Reddit%2C+Digg+and+Tumblr&newcomment=This+article+just+provides+%3Cstrong%3Eshare+link%2Furl%3C%2Fstrong%3E+of+%3Cstrong%3EFacebook%2C+Twitter%2C+Google+Plus%2C+Stumbleupon%2C+Reddit%2C+Digg+and+Tumblr%3C%2Fstrong%3E+and+instruct+How+to+add+share+link%2Furl+of+the+most+popular+social+media+websites+in+%3Cstrong%3EWordPress+%3C%2Fstrong%3Edetail+post." title="Let your friends on Stumbleupon know about this" class="stumblecopon"></a>
	<a href="http://reddit.com/submit?url=http%3A%2F%2F4rapiddev.com%2Finternet%2Fshare-link-url-of-facebook-twitter-google-plus-stumbleupon-reddit-digg-and-tumblr%2F&title=Share+Link%2F+Url+Of+Facebook%2C+Twitter%2C+Google+Plus%2C+Stumbleupon%2C+Reddit%2C+Digg+and+Tumblr" target="_blank" title="Let your friends on Reddit know about this" class="reddit"></a>
	<a href="http://www.tumblr.com/share/link?url=http%3A%2F%2F4rapiddev.com%2Finternet%2Fshare-link-url-of-facebook-twitter-google-plus-stumbleupon-reddit-digg-and-tumblr%2F&name=Share+Link%2F+Url+Of+Facebook%2C+Twitter%2C+Google+Plus%2C+Stumbleupon%2C+Reddit%2C+Digg+and+Tumblr&description=This+article+just+provides+%3Cstrong%3Eshare+link%2Furl%3C%2Fstrong%3E+of+%3Cstrong%3EFacebook%2C+Twitter%2C+Google+Plus%2C+Stumbleupon%2C+Reddit%2C+Digg+and+Tumblr%3C%2Fstrong%3E+and+instruct+How+to+add+share+link%2Furl+of+the+most+popular+social+media+websites+in+%3Cstrong%3EWordPress+%3C%2Fstrong%3Edetail+post." target="_blank" title="Let your friends on Tumblr know about this" class="tumblr"></a>
</div>

<div class="icon-share"> <a href="http://www.facebook.com/sharer.php?u=http%3A%2F%2F4rapiddev.com%2Finternet%2Fshare-link-url-of-facebook-twitter-google-plus-stumbleupon-reddit-digg-and-tumblr%2F&t=Share+Link%2F+Url+Of+Facebook%2C+Twitter%2C+Google+Plus%2C+Stumbleupon%2C+Reddit%2C+Digg+and+Tumblr" target="_blank" title="Let your friends on Facebook know about this" class="fb"></a> <a href="https://twitter.com/intent/tweet?source=4rapiddev&text=Share+Link%2F+Url+Of+Facebook%2C+Twitter%2C+Google+Plus%2C+Stumbleupon%2C+Reddit%2C+Digg+and+Tumblr&url=http%3A%2F%2F4rapiddev.com%2F%3Fp%3D4339" target="_blank" title="Let your followers on Twitter know about this" class="tw"></a> <a href="https://plus.google.com/share?url=http%3A%2F%2F4rapiddev.com%2Finternet%2Fshare-link-url-of-facebook-twitter-google-plus-stumbleupon-reddit-digg-and-tumblr%2F" target="_blank" title="Let your friends on Google Plus know about this" class="gg"></a> <a href="http://digg.com/submit?url=http%3A%2F%2F4rapiddev.com%2Finternet%2Fshare-link-url-of-facebook-twitter-google-plus-stumbleupon-reddit-digg-and-tumblr%2F&title=Share+Link%2F+Url+Of+Facebook%2C+Twitter%2C+Google+Plus%2C+Stumbleupon%2C+Reddit%2C+Digg+and+Tumblr" rev="technology" target="_blank" title="Let your followers on Digg know about this" target="_blank" title="Let your friends on Stumbleupon know about this" class="digg"></a> <a href="http://www.stumbleupon.com/submit?url=http%3A%2F%2F4rapiddev.com%2Finternet%2Fshare-link-url-of-facebook-twitter-google-plus-stumbleupon-reddit-digg-and-tumblr%2F&title=Share+Link%2F+Url+Of+Facebook%2C+Twitter%2C+Google+Plus%2C+Stumbleupon%2C+Reddit%2C+Digg+and+Tumblr&newcomment=This+article+just+provides+%3Cstrong%3Eshare+link%2Furl%3C%2Fstrong%3E+of+%3Cstrong%3EFacebook%2C+Twitter%2C+Google+Plus%2C+Stumbleupon%2C+Reddit%2C+Digg+and+Tumblr%3C%2Fstrong%3E+and+instruct+How+to+add+share+link%2Furl+of+the+most+popular+social+media+websites+in+%3Cstrong%3EWordPress+%3C%2Fstrong%3Edetail+post." title="Let your friends on Stumbleupon know about this" class="stumblecopon"></a> <a href="http://reddit.com/submit?url=http%3A%2F%2F4rapiddev.com%2Finternet%2Fshare-link-url-of-facebook-twitter-google-plus-stumbleupon-reddit-digg-and-tumblr%2F&title=Share+Link%2F+Url+Of+Facebook%2C+Twitter%2C+Google+Plus%2C+Stumbleupon%2C+Reddit%2C+Digg+and+Tumblr" target="_blank" title="Let your friends on Reddit know about this" class="reddit"></a> <a href="http://www.tumblr.com/share/link?url=http%3A%2F%2F4rapiddev.com%2Finternet%2Fshare-link-url-of-facebook-twitter-google-plus-stumbleupon-reddit-digg-and-tumblr%2F&name=Share+Link%2F+Url+Of+Facebook%2C+Twitter%2C+Google+Plus%2C+Stumbleupon%2C+Reddit%2C+Digg+and+Tumblr&description=This+article+just+provides+%3Cstrong%3Eshare+link%2Furl%3C%2Fstrong%3E+of+%3Cstrong%3EFacebook%2C+Twitter%2C+Google+Plus%2C+Stumbleupon%2C+Reddit%2C+Digg+and+Tumblr%3C%2Fstrong%3E+and+instruct+How+to+add+share+link%2Furl+of+the+most+popular+social+media+websites+in+%3Cstrong%3EWordPress+%3C%2Fstrong%3Edetail+post." target="_blank" title="Let your friends on Tumblr know about this" class="tumblr"></a> </div>

Apr 14, 2012Hoan Huynh
Display User Current Location On Google MapWordPress Get All Custom Fields
You Might Also Like:
  • PHP Auto Post A Story Content To Digg, StumbleUpon, Tumblr and LinkedIn
  • Get WordPress Short Link And Full Link To A Post
  • Top Social Bookmarking Websites Support Do Follow Link
  • Free service auto post to Facebook,Twitter,Google Buzz and LinkedIn
  • Place Twitter Tweet Button On WordPress
  • Share Page On Facebook With Thumbnail Featured Image
  • Import RSS Feed To Digg
  • Facebook Publish To Wall With External Link And Track Callback
  • Facebook Removed View App Profile Page link For New Apps
  • Access Blocked Facebook in Vietnam,China using Google DNS or Changing hosts file
Hoan Huynh

Hoan Huynh is the founder and head of 4rapiddev.com. Reach him at [email protected]

10 years ago InternetDigg, Facebook, get_permalink, Google, Reddit, Social Bookmarking, StumbleUpon, Tumblr, Twitter, Wordpress, wp_get_shortlink1,977
0
GooglePlus
0
Facebook
0
Twitter
0
Digg
0
Delicious
0
Stumbleupon
0
Linkedin
0
Pinterest
Most Viewed
PHP Download Image Or File From URL
24,558 views
Notepad Plus Plus Compare Plugin
How To Install Compare Text Plugin In Notepad Plus Plus
21,892 views
Microsoft SQL Server 2008 Attach Remove Log
Delete, Shrink, Eliminate Transaction Log .LDF File
17,746 views
JQuery Allow only numeric characters or only alphabet characters in textbox
15,071 views
C# Read Json From URL And Parse/Deserialize Json
11,805 views
4 Rapid Development is a central page that is targeted at newbie and professional programmers, database administrators, system admin, web masters and bloggers.
Recent Posts
  • Things to Learn about Installingderm Loan Type S
  • Online Photo Editor – Free Photoediting Software
  • A Guide to Finding the Best Paper Sellers
  • Photoediting in Home Isn’t Hard to Do!

  • Free Photo Editor Online
Categories
  • CSharp (45)
  • Facebook Graph API (19)
  • Google API (7)
  • Internet (87)
  • iPhone XCode (8)
  • Javascript (35)
  • Linux (27)
  • MySQL (16)
  • PHP (84)
  • Problem Issue Error (29)
  • Resources (32)
  • SQL Server (25)
  • Timeline (5)
  • Tips And Tricks (141)
  • Uncategorized (647)
Recommended
  • Custom Software Development Company
  • Online Useful Tools
  • Premium Themes
  • VPS
2014 © 4 Rapid Development