Jason Burns’ Blog

Icon

Thoughts from my warped little mind…

Change how Twitter Tools Formats Your Wordpress Blog Post Tweet

Alex King’s Twitter Tools Plugin is a must if you are a Wordpress Blogger and Twitter user. It’s most compelling feature is that it can automatically post a Tweet when you post a new blog post. This also works for time delayed posts, it Tweets when the post is published. One of the things I didn’t like about it was that it prefixed every blog post with “New Blog Post: “ which is a sure fire way to make sure more than half your followers don’t click it.

The thing is, you have already said what you want to say in your title hopefully, so how about we just Tweet the title and a link? Changing this code comes with one dire warning, you have to keep something in the prefix, that’s how the plugin finds Tweets to create the digest post, so instead of “New Blog Post: “, I am going to change mine to just “BP “.

Editing The Code

There is one class in the source code that defines the settings you can’t change in the UI, that class is called “twitter_tools.” Lines 18-27 define UI items, and 29-36 are supposed to not be end user editable, but we aren’t going to let that stop us.

   1:  class twitter_tools {
   2:      function twitter_tools() {
   3:          $this->options = array(
   4:              'twitter_username'
   5:              , 'twitter_password'
   6:              , 'create_blog_posts'
   7:              , 'create_digest'
   8:              , 'digest_title'
   9:              , 'blog_post_category'
  10:              , 'notify_twitter'
  11:              , 'sidebar_tweet_count'
  12:              , 'tweet_from_sidebar'
  13:              , 'give_tt_credit'
  14:              , 'last_tweet_download'
  15:              , 'doing_tweet_download'
  16:              , 'doing_digest_post'
  17:          );
  18:          $this->twitter_username = '';
  19:          $this->twitter_password = '';
  20:          $this->create_blog_posts = '0';
  21:          $this->create_digest = '0';
  22:          $this->digest_title = __("Twitter Updates for %s", 'twitter-tools');
  23:          $this->blog_post_category = '1';
  24:          $this->notify_twitter = '0';
  25:          $this->sidebar_tweet_count = '3';
  26:          $this->tweet_from_sidebar = '1';
  27:          $this->give_tt_credit = '1';
  28:          // not included in options
  29:          $this->update_hash = '';
  30:          $this->tweet_prefix = 'New blog post';
  31:          $this->tweet_format = $this->tweet_prefix.': %s %s';
  32:          $this->last_digest_post = '';
  33:          $this->last_tweet_download = '';
  34:          $this->doing_tweet_download = '0';
  35:          $this->doing_digest_post = '0';
  36:          $this->version = '1.0';
  37:      }

Lines 30 and 31 are what we are concerned with. Line 30 defines the Tweet Prefix. On my blog I changed this to just ‘BP’ to shorten it and get me back some characters. Line 31 defines the format string for the post, I also wanted to get rid of the colon, so I changed it to read:

$this->tweet_format = $this->tweet_prefix.' %s %s';

That’s it, now when your blog publishes, it will post a Tweet that’s a bit more concise and looks more like you wrote it rather than an automation.

Wordpress Plug-in Spotlight: Upload files from the Wordpress Dashboard with WP Easy Uploader

One of the problems with using a news style theme is that you constantly have to upload files for lead stories, etc. If you aren’t always on a machine with a full fledged blog client or possibly suffer from firewall restrictions like I do, you need to be able to upload your images through the [...]

Wordpress 2.7 beta1 First Impressions

I decided to take the plunge and give the beta a try on my main blog so here you have it. Philoking.com is running the Wordpress 2.7 beta1 in production. From the viewer perspective it should be transparent. For, it’s already a dream. The back end UI has had a total facelift and some of [...]

Wordpress for iPhone?

Do you believe it? Posting to my blog from my iPod Touch! If you speak iblogging, hit the app store now.

Testing the Wordpress 2.6 Image Caption Feature

This is me playing with my new studio setup

So I wanted to do this post to give a friend a chance to see how Wordpress handles this captioning problem, here it is, so disregard as being actual content
This text is pointless, but I want enough to make sure it wraps and we can [...]

Countdown Timer

On Twitter...