When it comes to blogging, social share buttons seem to have become the norm for modern websites. A strong social media presence is considered a must-have if you want to be noticed in the digital world today. Simply placing links to your social media profiles are not enough. You’ll want to encourage users to share your work & spread the word. The more shares, the more organic traffic you receive on your site. Such is the basics of SEO.

Using social share links with WordPress (the #1 blogging and CMS platform) is just a natural fit. Rarely I will ask clients if they want it included with their blog. Most times I will just include it unless they say otherwise.

There are countless plugins available on WordPress you can use for this purpose, simple share button adder, shareaholic, or social share buttons by supsystic just to name a few. But if you’re like me and like to avoid plugin clutter, you would prefer to add your own custom share buttons into a WordPress theme.

My first attempt at this led me to this popular discussion on Stack Overflow which shares the standard URL’s for popular media platforms. Some of which are no longer running. For now, I will use LinkedIn in the examples below:

http://www.linkedin.com/shareArticle?mini=true&url=[URL]&title=[TITLE]&source=[SOURCE/DOMAIN]

Where TITLE is the post title, URL is post link and SOURCE/DOMAIN is the homepage link. To Modify this for a WordPress blog, one could use:

 http://www.linkedin.com/shareArticle?mini=true&url=<?php print(urlencode(get_permalink())); ?>&title=<?php print(urlencode(the_title())); ?>&source=<?php get_site_url(); ?>

Like many share buttons, you’ll notice that a number of them pop open in a smaller window.  To achieve this effect, add in some JavaScript:

 http://www.linkedin.com/shareArticle?mini=true&url=<?php print(urlencode(get_permalink())); ?>&title=<?php print(urlencode(the_title())); ?>&source=<?php get_site_url(); ?>" onclick="javascript:window.open(this.href,'', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;

And finally the finished result. Here are some more examples of popular social media buttons customized for sharing in WordPress:

<a href="http://twitter.com/intent/tweet?status=<?php print(urlencode(the_title())); ?>+<?php print(urlencode(get_permalink())); ?>" onclick="javascript:window.open(this.href,'', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;">TEXT or IMAGE HERE</a>
<a href="http://www.facebook.com/sharer/sharer.php?u=<?php print(urlencode(get_permalink())); ?>&title=<?php print(urlencode(the_title())); ?>" onclick="javascript:window.open(this.href,'', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;">TEXT or IMAGE HERE</a>
<a href="https://plus.google.com/share?url=<?php the_permalink(); ?>" onclick="javascript:window.open(this.href,'', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;">TEXT or IMAGE HERE</a>
<a href="http://www.linkedin.com/shareArticle?mini=true&url=<?php print(urlencode(get_permalink())); ?>&title=<?php print(urlencode(the_title())); ?>&source=<?php get_site_url(); ?>" onclick="javascript:window.open(this.href,'', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;">TEXT or IMAGE HERE</a>
<a href="http://pinterest.com/pin/create/bookmarklet/?media=<?php $thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full' );?>&url=<?php print(urlencode(get_permalink())); ?>&is_video=false&description=<?php print(urlencode(the_title())); ?>" onclick="javascript:window.open(this.href,'', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;">TEXT or IMAGE HERE</a>
<a href="http://www.reddit.com/submit?url=<?php print(urlencode(get_permalink())); ?>&title=<?php print(urlencode(the_title())); ?>" onclick="javascript:window.open(this.href,'', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;">TEXT or IMAGE HERE</a>
<a href="https://digg.com/submit?url=<?php print(urlencode(get_permalink())); ?>&title=<?php print(urlencode(the_title())); ?>" onclick="javascript:window.open(this.href,'', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;">TEXT or IMAGE HERE</a>
<a href="http://www.stumbleupon.com/submit?url=<?php print(urlencode(get_permalink())); ?>&title=<?php print(urlencode(the_title())); ?>" onclick="javascript:window.open(this.href,'', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;">TEXT or IMAGE HERE</a>
<a href="http://www.newsvine.com/_tools/seed&save?u=<?php print(urlencode(get_permalink())); ?>&h=<?php print(urlencode(the_title())); ?>" onclick="javascript:window.open(this.href,'', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;">TEXT or IMAGE HERE</a>
<a href="http://del.icio.us/post?url=<?php print(urlencode(get_permalink())); ?>&title=<?php print(urlencode(the_title())); ?>&notes=<?php echo strip_tags( get_the_excerpt() ); ?>" onclick="javascript:window.open(this.href,'', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;">TEXT or IMAGE HERE</a>
<a href="http://www.evernote.com/clip.action?url=<?php print(urlencode(get_permalink())); ?>&title=<?php print(urlencode(the_title())); ?>" onclick="javascript:window.open(this.href,'', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;">TEXT or IMAGE HERE</a>
<a href="http://www.google.com/bookmarks/mark?op=edit&bkmk=<?php print(urlencode(get_permalink())); ?>&title=<?php print(urlencode(the_title())); ?>&annotation=<?php echo strip_tags( get_the_excerpt() ); ?>" onclick="javascript:window.open(this.href,'', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;">TEXT or IMAGE HERE</a>
<a href="mailto:?subject=<?php print(urlencode(the_title())); ?>&body=Check this out: <?php print(urlencode(get_permalink())); ?>">TEXT or IMAGE HERE</a>

If I have missed any big ones, feel free to drop a comment below.  I will check back every so often to make sure none of these examples have been deprecated.  Hopefully this will save you some time with your next WordPress project!

Leave a Reply

Your email address will not be published. Required fields are marked *
You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>