In my previous post I talked about setting up a WordPress self hosted blog with minimal coding… in fact I think it involved ZERO coding. Part of that exercise included adding Social media share buttons to posts. I ended up recommending a plugin. Anyway, back in the real world where people develop websites seriously and don’t treat WP as a WYSIWYG DIY hack job, that’s not what we would do.
What we would probably do is one of two things.
Either we would implement the most expensive professional solution. Or the least expensive professional solution.
The most expensive solution would be to first carefully review the current recommended practices from the Social Networks themselves. And as I do this now I can see Twitter and Facebook have several digital reams worth of reading material on how they want you to do things, complete with configurators and example code etc. This is probably something you would implement in consultation with an SEO or Social Media expert as part of a big budget digital marketing strategy.
But if you’re not working for silly money, and still require a professional solution, I recommend this minimalist approach. It’s lean. Doesn’t require 136 http requests. Doesn’t get you hooked into commitments. Just works, plugin free.
Here’s the code.
<a href="https://www.facebook.com/sharer/sharer.php?u=<?php the_permalink(); ?>" target="_blank" class="small-button share-fb" > SHARE ON FACEBOOK </a> <a href="https://twitter.com/home?status=<?php the_permalink(); ?>" target="_blank" class="small-button share-tw" > SHARE ON TWITTER </a>