Advanced Tools for Wordpress: Part 1

Note: This post is over 3 years old. You may want to check later in this blog to see if there is new information.

This is part 1 of an ongoing series about my adventures in learning and implementing new tools for web design and blogging on the OS X platform. The first series is going to focus on blogging, specifically with Wordpress (although most of the information will be perfectly applicable to other packages). The next series will be devoted to web development using a suite of other free and inexpensive tools for OS X. I plan to cover a lot of ground, so this may take a while ;-).

The first tool we’re going to look at is TextMate. TextMate is an extremely advanced, extensible text editor for Mac OS X that happens to have blogging capabilities included (along with code highlighting and completion for just about every language you or I know). This first entry is going to be an exploration of it’s general and blog-specific features. Up front I’ll tell you that it costs around $50 USD. So if you’re just looking for a tool to put simple posts on a blog, this might not be it (try Performancing or Ecto, maybe). But if you want something more, read on…

Blogging with TextMate: It’s not for everyone

If you usually use the Rich Text Editor in Wordpress (or any blogging platform), you may want to look elsewhere. TextMate is a text editor with no toolbar. All of the functions are accessed through keystrokes and “tab-triggers”. It takes a minute to get the hang of it, but once you do, you’ll start editing everything in it. And you can, because it integrates very well with the OS X operating system (that’s for the next series).

If, however, you meticulously craft your posts using the stripped down editor, or paste code from another HTML editor, you’re in the right place. If you know all of the styles in your CSS file by heart, if you make every effort to keep your blog standards compliant, even if you just like the flexibility of typing a little HTML once in a while, you may find TextMate as useful as I do.

Getting Started

There’s a great screencast at the TextMate site that will help you get started and set up your blogs. It’s really simple.

A Bug in Wordpress

There’s a bug in Wordpress that causes it to return an invalid size header in the XML file. It’s not necessary to the function of the blogging features of TextMate, but it will cause your first attempt to set it up to fail. So you have to dive right in and make it work. If you’re going to have the problem, you should see an error something like:

/usr/lib/ruby/1.8/xmlrpc/client.rb:551:in `do_rpc’: Wrong size. Was 58591, should be 58818 (RuntimeError)

You’re actually going to have to edit client.rb. Load it up in TextMate (copy the location from the error message, load up terminal and type ‘mate’ and paste in the location after it). The error says line 551, so that’s where we’ll jump to: (cmd)-L -> 551. Comment out the elsif statement in the expected = block there. Just highlight the two lines and type (cmd)-/. It’s a hack, but I haven’t had any problems…

Killer Features

So what are these features that made me fall in love with a text editor? It’s not so much the features (Code highlighting, indenting, spellcheck as you type…) as the extensibility of the package and the things that you can do with it right out of the box. For example:

If you have a list of items in plain text, perhaps a snippet from some notes:

Item 1
Item 2
Item 3
Item 4
Item 5
Item 6
Item 7
Item 8
Item 9
Item 10

And you want to turn them into an unordered list, just highlight the block and type (Control-Shift-Option)-W to wrap each line in an open/close tag. A tag will be placed around each line, and the contents of the first tag will be highlighted. Just type “li” and it will be mirrored and repeated for each line. Then select the whole thing and type (Ctrl-Shift)-W to wrap the selection in an open/close tag. Type “ul” once and you’re done. And if those key combos seem hard to remember, don’t worry, the only one you need to know is (ctrl-command)-T. That brings up a search window (Select Bundle Item) where you can just type any part of the command you’re looking for and it will do a (fuzzy!) search for your command, which can then be selected with the arrow keys and executed.

Or how about automatic linking? TextMate interfaces with Amazon and Google. With Google, you can just highlight a word and hit (ctrl-shift-command)-L and it will link the selection to the first match on google automatically. Both of the preceding links were created with this method.

What About Blogging?

Well, all of the obove features are useful in the creation of a post. But TextMate can interface directly with multiple blogs and post directly to them. You just set up your blogs names and endpoints (in the case of Wordpress this is http:example.com/xmlrpc.php). Then you load up customizable templates (HTML, Textile, Markdown or Text) and when you’re ready to post, just press (ctrl-command)-P. Or choose it from the Select Bundle Item menu (ctrl-command)-T ;-).

Out of the box, TextMate can upload and link images in your posts. Drop an image from your Finder onto your edit window and it will ask you for a title for the image. It will give the image a name based on the title, upload it to the server and create a link in your post to the correct location on the site. With a little hacking you can do a lot with this. Later in the series I’ll be showing you how to incorporate “RMagick” to create and link thumbnails. That involves some actual bundle hacking, but even without editing code you can add XHTML elements such as microformats and title tags. That’s next time.

Another blog specific feature is the ability to pull down your last 20 posts and open/edit them. You can even save drafts, open them back up from the server and publish them. I’m currently adding a Status: Draft header to all of my posts from TextMate and then previewing them in Wordpress and adding my UTW tags before publishing. After a draft is uploaded, TextMate can open it directly in a browser window, published or not. XMLRPC provides all of the necessary information to directly access most of the pertinent information for the post. I’ve already added the ability to choose the categories for the post from a dropdown menu, which I’ll show you how to do in the last part of this series. Or maybe I’ll save the image thumbnailing for last. I love a good mystery.

Next Time

This post only grazed the surface of what TextMate can do, and only in the limited capacity of blogging. Next time we’ll get into some customizations and ease-of-use modifications that you can make without editing any source code.

» » »

Comments are closed

Comments are currently closed on this entry.

Comments are closed.