I've just upgraded to WordPress 2.2 and now Ultimate Tag Warrior is broken and my TextMate tagging doesn't work anymore.
So here is the explanation on how to get the two working again.
READER DISCOUNTSave $50 on terminal.training
I've published 38 videos for new developers, designers, UX, UI, product owners and anyone who needs to conquer the command line today.
$49 - only from this link
Job number 1: get tags working in Wordpress. Job number 2: get tags (and comments and pingback) recognised in the blogging TextMate bundle.
Firstly, we need to add tag support. I found Ultimate Tag Warrior 3 which did the job just fine.
There's a few alternatives, like Simply Tagging - but it will require a different tagging function in the XMLRPC changes below (which, for now, I've not figured out).
The install is straight forward and you can start tagging pretty quickly from the web interface.
Ultimate Tag Warrior working in 2.2
There are three simple steps to fixing UTW in 2.2 - which I've summarised from moeffju.net:
- Search and replace is_tag with UTW_is_tag in ultimate-tag-warrior.php
- Search and replace is_tag with UTW_is_tag in all the files in your active theme directory.
- If you use '/tag/mytag' as your link structure - ensure you have the following in your .htaccess:
RewriteRule ^tag/(.*)$ /index.php?tag=$1 [QSA,L]
Tag Support for TextMate
This is the script that handles the posting on the server side. Basically, it needs to be hacked to support tags.
You need to backup a copy of your xmlrpc.php file. That's just good practice.
Download patch XMLRPC
On Dan's suggestion, I am offering my own xmlrpc.php file for you to use.
This is the xmlrpc for WordPress 2.2. For WordPress 2.0 - see my earlier post on getting tagging working in Wordpress 2.0
Details on XMLRPC changes
Rather than explain it myself, a chap called Robin Lu has already written it up. However, watch out for the quotation marks - in Rubin Lu's blog, they're formatted, so if you paste the changes in, it will more than likely break your xmlrpc.
Step 1: How to make ecto work with Ultimate Tag Warrior.
Step 2: How to make ecto work with Ultimate Tag Warrior - Part II
Ignore the 'ecto' part - it's a blogging software product, but it'll do for our purposes.
The key change you need is mt_keywords to mt_tags.
Patching Blogging Bundle
You can use my patch, or patch the blogging.rb file yourself.
Download the latest blogging.rb patch and run the patch command:
patch -p0 < blogging.rb.patch
Manually Patching Blogging Bundle
You'll need to edit the blogging.rb file in the /Applications/TextMate.app/Contents/SharedSupport/Bundles/Blogging.tmbundle/Support/lib/ directory.
Find the following lines:
@post['mt_tags'] = @headers['tags'] if @headers['tags']
Then copy it below the
elsif self.mode == 'wp'
@post['mt_allow_comments'] = @headers['comments'] =~ /\b(on|1|y(es)?)\b/i ? 'open' : 'closed' if @headers['comments'] @post['mt_allow_pings'] = @headers['pings'] =~ /\b(on|1|y(es)?)\b/i ? 'open' : 'closed' if @headers['pings']
And change the instance of 'open' to '1' (keeping the number in the quotation) and 'closed' to '0' (again keeping the quotation), so you have this:
@post['mt_allow_comments'] = @headers['comments'] =~ /\b(on|1|y(es)?)\b/i ? '1' : '0' if @headers['comments'] @post['mt_allow_pings'] = @headers['pings'] =~ /\b(on|1|y(es)?)\b/i ? '1' : '0' if @headers['pings']
That should be it. You should be able to see my tags working on my Wordpress blog right now.