Simple, Plain-Text Social Sharing Links

The web is awesome, blogs are a revolution. But the ease of self-publishing comes at a price: the mass use of pre-packaged designs and tack-on solutions, all of which add to visual noise and serve to cheapen the content. Over at alidark.com I’ve been aiming to reinstate a smidgen of the dignity by paring things down and focussing on the words that matter.

It’s a matter of personal preference of course – but the prevalence of sharing buttons on the web and the visual impact they make is a matter of contention among designers, some of whom seem to live in an alternate reality populated entirely with minimalists.

While I’d like to think I’m less of a Design Nazi, I hear their point loud: the web is empowered to the point of taking away from the actual content. We’re super-connected in such a way that meaning is actually drowned in noise.

Having removed sharing buttons from my site for a while, I felt good. But soon I realised I was being left out. Even the most sharing-empowered browsers don’t really make sharing that much easier. The new Tweet function in Safari starts you off with an empty tweet, for example, where really needs to have the Title of the page stuck in there defacto.

Here’s a solution that’s less intrusive than Twitter’s javascript or inline-frame powered button defaults, but is just as powerful in giving your users a head start by adding your title, url and Twitter handle to their tweet automagically.

See an example on any of my latest thoughts or articles (or actually now, at the end of this post).

It’s simple but perfectly clear, passively, content-integrated and it waits for the user to finish reading a page before bothering them with the possibility of tweeting it, if you choose to use it after your post, that is.

It’s powered by the ‘build your own’ Twitter share URL and allows you to add the necessary variables to the a link url. Combine this with some WordPress php functions, and you have a customised link to share each of your pages and or posts on Twitter.

You’ll need to embed this link in your themes files of course, but as with all tweaks it’s preferable to using a plugin (assuming one exists for just this purpose, I have no idea) which generally burden your site and are potential flaws in your security.

Here’s the link I created, which shows you how it’s done. Becasue it contains php, it needs to go on your post and/or page theme file, accessible via your dashboard under Appearance > Themes. Placing the code inside the content div will probably ensure it appears after the actual content, depending on what other plugins you’ve got running. You’ll likely find this at single.phpcontent-single.php (for posts) or content-page.php (for pages).

Before you tackle this, take a moment to think about the possible consequences and fact that I won’t be doing free support in the comments – you’re on your own. If you’d like me to implement this for you, it’ll cost you $50.

<a href="https://twitter.com/share?url=<?php echo wp_get_shortlink(); ?>&lang=en&text='<?php the_title(); ?>' via @twitterhandle&conturl=<?php echo wp_get_shortlink(); ?>&count=vertical" target="_blank">Tweet this</a>.

Add in your own twitter handle and you’re good to go. However there may be other properties you wish to define. This page lists the full properties which can be added to your tweet link, under the heading: Properties which can be used by all types of the Tweet Button.

Facebook

Although Facebook doesn’t have a simiar build-your-own share link you can use, it does have a bookmarklet. Which just so happens to work in exactly the same way as a link.

Visit the Facebook Share Options page and copy the link from the bookmarklet. That link, placed on any page, will popup the usual Facbook share dialog from which you can share the link with a thumbnail with an excerpt and with or without a comment and thumbnail.

The link is javascript, so will work in most browsers and on most devices. You could also the links from other bookmarklets in the same way.

As an afterthought – when did Facebook share get so powerful? Loving the option of where to share, if it wasn’t always there.

So now, you can see below that Twitter and Facebook are once again side by side, keeping each other company through bits and kilobytes.

Google Plus

A solution for Google+ can also be found (hat tip to Raam Dev for the link).

Linked In

Copy the link from the bookmarklet on this page.

Posted on October 18, 2012 ... Modified October 2, 2015