I use TextMate quite a bit. Actually that’s an understatement; I use the holy shucks out of of TextMate.1 I could get tangental here and start describing, in lurid and shameful detail, my life as a degenerate txt-head, but I’ll save that for a future article.
The built-in Blogging Bundle is probably the feature I use the most in TextMate. Using XML-RPC, this bundle can connect to your blog and pull down a list of posts to edit. Or similarly, you can create a new post in TextMate and post it to your blog. This is pretty cool, but got super cool when I came across this nugget of knowledge that describes how to tweak WordPress so that you can use the Blogging Bundle to edit pages as well.
This is so incredibly useful. WordPress is great, but being the txt-head I am, I work better in a text editor, especially the mighty TextMate. Last summer, I was involved with a complete overhaul and redesign of The Leakey Foundation’s website. We changed the CMS from Joomla to WordPress, and streamlined and reorganized all of the content on the site, taking it from >120 static pages to just under 60 pages. The editor in the WordPress backend is very functional and works well for most applications, but I’d still be working on leakeyfoundation.org today if I didn’t have the ability to edit pages and posts via the TextMateBlogging Bundle.
A recent update to WordPress 3.1 finally broke the the solution Sameer posted in his site, as it looks like Automattic, et al, totally rewrote wp-includes/post.php. But I am pretty sure I figured out to fix it.
How To Enable Editing of WordPress Pages with the TextMate Blogging Bundle
FTP on over to your site and open wp-includes/post.php. It’s probably a good idea to back up this file before hacking away at it. Also, you’ll have to make this edit every time your WordPress install gets updated. Look for this section in wp-includes/post.php (around line 2266):
/** * Retrieve number of recent posts. *
Scroll down a few lines to this:
// Set default arguments $defaults = array( 'numberposts' => 10, 'offset' => 0, 'category' => 0, 'orderby' => 'post_date', 'order' => 'DESC', 'include' => '', 'exclude' => '', 'meta_key' => '', 'meta_value' =>'', 'post_type' => 'post', 'post_status' => 'draft, publish, future, pending, private', 'suppress_filters' => true );
And change post_type to ‘any’
// Set default arguments $defaults = array( 'numberposts' => 10, 'offset' => 0, 'category' => 0, 'orderby' => 'post_date', 'order' => 'DESC', 'include' => '', 'exclude' => '', 'meta_key' => '', 'meta_value' =>'', 'post_type' => 'any', 'post_status' => 'draft, publish, future, pending, private', 'suppress_filters' => true );
Also, the Blogging Bundle “Fetch Post” dialogue window is limited to 20 posts, but this can be changed by editing blogging.rb inside blogging.tmbundle2
around line 576 of blogging.rb look for
begin result = self.client.getRecentPosts(self.blog_id, self.username, current_password, 20)
change the “20” to whatever number is suitable, but keep in mind if you set the number high, it might take a while for your posts to load and could even crash the connection. 120 works well for my usecase, but it takes >30 secs to load the list of posts.
begin result = self.client.getRecentPosts(self.blog_id, self.username, current_password, 120)
And there you have it.