July 19th, 2009
I found this little tool somewhere online the other day, and thought it was worth looking into. AddThis is a little button/gizmo that allows a browser of the the site to instantly push content they want to share to any one of some 50-odd social networking sites. Now, if you know me, you know that I really do not care for the ol’ social networking thing. Something about it still strikes me as… oh I don’t even know.
I don’t like it and, largely, I don’t us it.
But other people do! If you are one such person, and you feel so inclined, we now have a “Share this Observation” feature located after the meta info for each entry. Mouse-over for the main options, click it for the whole song and dance. [the notion that I've opened the doors to people aggregating my site to bebo is sickening... to say the least.]
onmouseover="return addthis_open(this, '', '[URL]', '[TITLE]')"
onmouseout="addthis_close()" onclick="return addthis_sendto()">
<img src="http://s7.addthis.com/static/btn/lg-share-en.gif" width="125" height="16" alt="Bookmark and Share" style="border:0"/></a>
I’d just installed the plugin, and was rather irritated to see it sitting, smugly, to the left, at the end of the entry. As you can see (at the time of writing) all the meta data is clearly on the right-hand side of the page. Such a displeasing destruction of symmetry is inexcusable, even here at the blog-hack-capital of the internet, Schrödinger’s Blog. The above is the code they provide for you to just install it on any ol’ website. I looked at that, and thought, “it really can’t be that hard to get that thing working the way I’d like.”
Turns out, a manual install of AddThis to a WordPress blog is easier than I thought. I don’t know a ton about how this hunk-a-junk works, but I knew that AddThis essentially just calls for a URL and a title for it to pass on to all those other services. I know from programming the template for this site that two such tags exist:
<?php the_permalink() ?> - For the link to the entry
<?php the_title(); ?> - For the entry's name
So… you grab those, stick them in where AddThis supplies [URL] and [TITLE], and game over. It functions just the way it would if you installed the plugin, but now you’re free to stick that little chunk of code wherever you’d like in your template! I slung mine over to the right, and used one of the AddThis images available for download, just to slim down the entire affair. My final code appeared as follows:
onmouseover="return addthis_open(this, '', '<?php the_permalink() ?>', '<?php the_title(); ?>')"
onclick="return addthis_sendto();">Share the Observation <img src="http://schrodingersblog.com/images/plus.gif" alt="Share This" style="border:0"/></a>
var addthis_brand = "Schrödingers Blog";
var addthis_options = 'email, facebook, twitter, delicious, digg, stumbleupon, wordpress, favorites, more';
var addthis_header_color = "#ffffff";
var addthis_header_background = "#000000";
So. That was a fun little project. It was something I’d been meaning to play with. I get irritated when projects like that pop up, but it’s a good opportunity for a little spot of problem solving and I always feel pretty badass when I can code my way out of an annoying problem. [Also: Big thanks to Damnit Jim! for the WP_CodeShield plugin]
Finally: My quest continues for a good plugin for “buy” or “purchase” links. I don’t want to scare anyone into thinking I’m trying to mine money off of this godforsaken little blog. I’m just trying to gear it up as a music-blog that I might one day submit to Hype Machine or elbo.ws, and they’re pretty particular about making sure you give readers the opportunity to purchase the artist’s music. I really like what billy’s done over at TWF, but either he did that by hand, or the plugin has a name I can’t think of.