How-to: Easily Link to Social Media Websites in Wordpress
- BY Eric/Steel Frog, August 4 2009 -
Social media: where would the internet be without it? In a recent project, I’ve had to create quite a few links to various social media websites and have come up with a series of Wordpress-based links you can use in your next project. Note that the code samples below only include the opening anchor for easy integration.
The list is in alphabetical order for easy navigation.
I opted to use Wordpress’ built-in urlencode() function to generate a browser-friendly URL.
More information on this function can be obtained on the Wordpress Codex.
Del.icio.us
Example: Click here to submit this article to Del.ici.us.
<a href="http://www.delicious.com/post?url=<?php the_permalink(); ?>&title=<?php echo urlencode(get_the_title($id)); ?>" title="Submit this article to Del.icio.us">
Digg
Example: Click here to submit this article to Digg.
<a href="http://www.digg.com/submit?phase=2&url=<?php the_permalink(); ?>" title="Submit this article to Digg">
Example: Click here to submit this article to Facebook.
<a href="http://www.facebook.com/sharer.php?u=<?php the_permalink();?>&t=<?php echo urlencode(get_the_title($id)); ?>" title="Submit this article to Facebook">
Example: Click here to submit this article to Reddit.
<a href="http://www.reddit.com/submit?url=<?php the_permalink(); ?>&title=<?php echo urlencode(get_the_title($id)); ?>" title="Submit this article to Reddit">
StumbleUpon
Example: Click here to submit this article to StumbleUpon.
<a href="http://www.stumbleupon.com/submit?url=<?php the_permalink(); ?>&title=<?php echo urlencode(get_the_title($id)); ?>" title="Submit this article to StumbleUpon">
Example: Click here to Tweet about this article.
<a href="http://www.twitter.com/home?status=<?php echo urlencode("I am reading: "); ?><?php the_permalink(); ?>" title="Tweet this article">














