That WordPress plug-ins such as Add to Any and Sociable are constantly among the most popular WordPress plug-ins in their directory is proof that most people like to add Social Media buttons to their blogs. Not surprising to me, of course- I’m one of those that loves to Add to Delicious, Share on Facebook, and Tweet This directly from an interesting post I find.
If you author WordPress Themes, you might want to add Social Media buttons to your Themes yourself. Here’s a quick and easy way to do it:
First, get some buttons. Design them yourself, or download some free designs. There are lots of beautiful ones out there: try here or here.
Once you have your collection of buttons, create some code to add to your WordPress Theme single.php templates (and anywhere else you want the buttons to be). Here’s an example:
Like this post? <a href="http://del.icio.us/post?v=4&noui&jump=close&url=<?php the_permalink();?>&title=<?php the_title();?>"><img src="<?php bloginfo('template_directory'); ?>/images/delicious.png" alt="Bookmark on Delicious" /></a> <a href="http://twitter.com/home?status=Currently reading <?php the_permalink(); ?>"><img src="<?php bloginfo('template_directory'); ?>/images/twitter.png" alt="Send to Twitter" /></a> <a href="http://www.stumbleupon.com/submit?url=<?php the_permalink(); ?>"><img src="<?php bloginfo('template_directory'); ?>/images/stumbleupon.png" alt="Stumble it" /></a> <a href="http://digg.com/submit?phase=2&url= <?php the_permalink();?>&title=<?php the_title();?>"><img src="<?php bloginfo('template_directory'); ?>/images/digg.png" alt="Digg This" /></a>
Does it look confusing? Let’s break down the Delicious button:
<a href="http://del.icio.us/post?v=4&noui&jump=close&url=<?php the_permalink();?>&title=<?php the_title();?>"><img src="<?php bloginfo('template_directory'); ?>/images/delicious.png" alt="Bookmark on Delicious" /></a>
The link grabs the post’s permalink and title, and sends it to Delicious. It looks for a Delicious button in the images/ directory of your Theme.
You will, of course, want to edit the code to point to your button images and/or refer to completely different Social Networks.
Why add Social Media buttons to your Theme at all?
The users of your theme don’t need to install a plug-in. Not everyone knows how to install WordPress plug-ins, and many simply don’t care to.
You can style them your way. You’ve put a lot of work into making your Theme look a certain way, so styling the Social Media buttons yourself makes sense.
It’s a “feature”. In the description and/or Read Me of your finished Theme, make sure to mention that you have Social Media buttons built-in. But also be sure to make it easy for users to disable the buttons if they don’t want to use them.
Do you add Social Media buttons to your Themes?