Personalising AddThis’s Tweet Button Personalising AddThis’s Tweet Button
  • Home
  • Posts
  • Home
  • Posts

Social Media

Personalising AddThis’s Tweet Button

AddThis is a quite useful WordPress plugin for adding a host of sharing options to your blog posts.

By default, the “Tweet” button that AddThis provides will append “via @AddThis” to the end of tweets, which seems to me a little uncool, given that it’s your content.

So, here’s a little plugin that lets you specify your own Twitter account name instead of @AddThis.

The principle is simple: AddThis were kind enough to define their own filter for the plugin’s output. The plugin plugs itself into this filter, and makes an adjustment to the Tweet button.

To use it, put addthis-modifier.php into your wp-content/plugins folder, open it up and set your twitter name where indicated. Activate it, and you should be good to go.

Download the plugin: AddThis Modifier Plugin

For extra marks: Here’s some code you can use to replace line 14 (the $twittername = … line) to provide a different Twitter account for each post author. Is that not awesome?:

    $accounts = array('Michael'   => 'MichaelTyson',
                      'Katherine' => 'NellieWindmill');
    $twittername = $accounts[get_the_author()];

$accounts = array('Michael' => 'MichaelTyson', 'Katherine' => 'NellieWindmill'); $twittername = $accounts[get_the_author()];

Read More

Hi! I'm Michael Tyson, and I run A Tasty Pixel from our home in the hills of Melbourne, Australia. I occasionally write on a variety of technology and software development topics. I've also spent 3.5-years travelling around Europe in a motorhome.

I make Loopy, the live-looper for iOS, Audiobus, the app-to-app audio platform, and Samplebot, a sampler and sequencer app for iOS.

Follow me on Twitter.

© 2021 A Tasty Pixel.