Blue Share

As a little learning exercise, I created a plugin for WordPress that adds a small Twitter icon to the bottom of each post. When a reader clicks on that icon they are prompted to enter their Twitter username and password, and a short message (the title of the post and a link to it) will be added to their Twitter feed, allowing them to share the post with their followers.

If you’d like to play with it (and I emphasise at this point that this is still a work in progress), you can download it. Instructions for installation and customisation are after the jump.


  1. Unzip the file in the wp-content/plugins directory.
  2. Go to the plugins page in the WordPress admin panel, and activate Blue Share
  3. Update your theme template files to include the following bit of PHP magic in the place where you’d like the ‘Share This’ link to appear:

    <?php if(function_exists('blue_share')) { blue_share(); } ?>

    You will probably want to add the link code to index.php, single.php and archive.php.

The current version doesn’t have a lot of customisation options. You can change the style information through the style.css file in the plugin’s directory (wp-content/plugins/blue-share), but these will be overwritten if you upgrade, so be sure to keep a copy. A future version will allow the styles to be overridden by the current theme more easily, so that this is not a problem. Update July 7, 2008: The latest version now reads the blue-share.css style sheet from the current theme if it exists, or falls back on the default style.css in the plugin directory if it doesn’t exist. This allows you to keep your style modifications in your theme directory, safe from being overwritten by upgrades to the plugin.

I’m open to suggestions for other enhancements too, especially other services that you would like to see included in the list of sites that the message can be posted to.

Update (July 7, 2008):

  • The style sheet now has an override capability. Add a style sheet called blue-share.css to your theme’s directory to replace the default Blue Share style.css file (hint: start by making a copy of the default style.css file in your theme, then modify it).
  • Support for has been added to the plugin too now (more services are planned too – get your vote in for ones you’d like to see and I can try to work on the most popular ones first).

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.