AddThis


Today I was tasked with adding several Social Bookmarking sites to a client’s website, at work. Whilst reading through the various APIs for each site, I decided to look at AddThis that I had come across over the weekend.

AddThis saved me 2 days (estimated) development time, by combining all of the popular Social Bookmarking sites in one easy-to-integrate solution. I was so impressed that I decided to add AddThis to slickhouse!

AddThis provides a WordPress plugin from the outset, but I often find plugins to be too restrictive. AddThis is also available as a standard button or a dropdown menu, displaying several options. All 3 options use a new window to display the various Social Bookmarking sites.

I decided to opt for the dropdown, but hard-coded into the WordPress theme files. Firstly, to display AddThis on the main pages, open index.php and add the AddThis code. However, as you’ll most likely be calling this code several times on the page, you need to define the URL and Title for each instance of AddThis:

addthis_url = ‘<?php the_permalink() ?>’;

addthis_title = ‘<?php the_title(); ?>’;

Use the above to replace the default Javascript location.href and document.title respectively. This uses WordPress’ dynamic variables for each instance of AddThis.

On a single WordPress page (single.php), you can use the default code provided by AddThis easily enough, or use the above alterations - either way will work fine, as you should only be calling AddThis once.

And hey presto - AddThis has been added to WordPress! Feel free to use AddThis to add slickhouse posts to your preferred Social Bookmarking site. Personally, I’m a Digg/Google user.

5 Responses to “AddThis”

  1. Administrator Says:

    A day later and I discovered how to alter AddThis to enable me to use a different button for the dropdown version. Simply copy the Javascript output (from the src= within the AddThis code) and make a local copy instead. The Javascript is messy as one block, but after 15 minutes or so, you should end up with a well laid-out piece of code - from which you can easily alter the source of the bookmark button.

  2. Dr. Mohamed Taher Says:

    Hi
    Thanks for the details. I registered myself and posted the code. The code on the page doesnt show my blog post. any reason what I am missing in the code?
    Best, MT

  3. Administrator Says:

    Perhaps try an AddThis plugin for WordPress first, to see if that works? Then look at the above.

  4. Dr. Mohamed Taher Says:

    What about using this in Blogspot? Will it work or what is missing in my code?

  5. Administrator Says:

    Sorry for the delay - it appears that you’ve got it working with Blogspot? Let me know if not and I’ll look at the source code.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>