Sharing Your WordPress Posts Without A Plugin

I’ve been asked by a few people how I made my social sharing links on this site, (the ones that used to be seen right below the post title on single pages).  It’s actually pretty simple, and I have no problem showing others how to do the same thing.

First of all, my goal was to create sharing links to various social networks without the use of external javascripts or anything like that.  Granted, I lose some of the features that come with these scripts (such as share counts), but I also do not slow my site down waiting on 3rd party scripts to load.  Well, I take that back; I did use a little snippet of javascript in each link, but that was just to get them to pop open in new windows.

So let me run down the link code I used for each social network and explain how I did it.

Twitter

<a href="http://twitter.com/?status=<?php the_title(); ?>%20<?php echo wp_get_shortlink(get_the_ID()); ?>" onclick="window.open(this.href); return false;">TWITTER</a>

For the twitter sharing link I opted to use the WordPress shortlink instead of the full URL in order to keep the tweet as short as possible.  If a visitor decides to share my post on Twitter, a new window pops up to their twitter page that has automatically filled in a new tweet that includes the post title and the link to the post.

Facebook

<a href="http://www.facebook.com/sharer.php?u=<?php the_permalink();?>&amp;t=<?php the_title(); ?>" onclick="window.open(this.href); return false;">FACEBOOK</a>

I did the same thing for facebook, except I used the full URL instead of a shortlink.  Facebook handles their updates a little different than other sites, so space isn’t a problem.  I have also done a little more customization in which image gets used on Facebook when a post of mine is shared, but that’s a post for another day.

Reddit

<a href="http://reddit.com/submit?url=<?php the_permalink(); ?>&amp;title=<?php the_title(); ?>" onclick="window.open(this.href); return false;">REDDIT</a>

The Reddit sharing link works pretty well.  When a visitor wants to share a post on Reddit, the submit screen will be automatically populated with the URL of their submission as well as a title.  All that’s left is for them to choose which sub-reddit to submit it to.

Digg

<a href="http://digg.com/submit?phase=2&amp;url=<?php the_permalink(); ?>&amp;title=<?php the_title(); ?>" onclick="window.open(this.href); return false;">DIGG</a>

The Digg submission link works much in the same way as the Facebook sharing link.  Once clicked, the Digg submission screen is automatically filled with the post’s URL and title, as well as the selected image I already have in place from the Facebook customization.

StumbleUpon

<a href="http://www.stumbleupon.com/submit?url=<?php the_permalink(); ?>&amp;title=<?php the_title(); ?>" onclick="window.open(this.href); return false;">STUMBLE</a>

When the StumbleUpon link is clicked, the user is taken to their stumble submission page with the URL already inserted.  From there, the user just needs to select a topic and a review (if they choose to).

Google Buzz

<a href="http://www.google.com/buzz/post?url=<?php the_permalink();?>" onclick="window.open(this.href); return false;">BUZZ</a>

The Google Buzz link also works like the Digg and Facebook sharing link.  Once clicked, the user is taken to the Buzz submission page and the URL, description, and post image is automatically inserted and selected.  A very clean and simple process.

Email

<a href="mailto:?subject=<?php the_title(); ?>&amp;body=Check out this article! <?php the_permalink() ?>">EMAIL</a>

There’s nothing too fancy with this link.  If a user decides to send a post of mine to somebody via email, they can click this link and their default email program will pop up that has the subject line and email content prefilled with the info I included in this link.  All the user has to do is enter a recipient.  You can easily edit the body content to your liking by editing this sharing URL.

Final thoughts

This is how I chose to implement social sharing for the material on this site.  This may or may not suit your needs.  If you want to have some visible metrics, like how often your posts have been shared, then you would want to either install a social sharing plugin to your WordPress site or use the default sharing scripts provided by some of these social circles.

468x60-2

{ 1 comment… read it below or add one }

creativeguy May 31, 2012 at 12:01 pm

i’m very much interested sir in applying these tricks.

but i don’t understand how do i apply them on my blog.

my site is this : http://oceancitymagic.com/Ocean-City-News/

i earlier used sharing plugins which terribly slowed down my site so now i want to apply your tricks. can you please tell me how do i apply them in wordpress.

which files do i paste the above codes.

i’m using pagelines framework.

if you can tell me i would be really grateful to you. thanks.

Reply

Leave a Comment

Previous post:

Next post: