Editing WordPress pages using blogging tools
February 26, 2009
I’m a heavy user of TextMate, and use the blogging bundle to create and edit posts. I’m also a heavy user of WordPress Pages that enable wordpress to be used as a CMS. The one issue that always bugs me with any new WordPress installation is that you cannot edit pages from XML-RPC blogging tools like TextMate, Ecto, Windows Live Writer and such. The only working solution I’ve found to the same is a little ugly: You’ll need to edit one of the core wordpress files. I wouldn’t do it if I didn’t love TextMate so much.
This post from Maison Bisson described the process of editing the files for a previous version. The good news is, for the latest WordPress releases (I’ve checked 2.7.0 and 2.7.1), the data model has been changed to remove the “static” post status for pages (They now have the same status codes as posts), which means that no changes are required to the update fundtion; and a field called post_type now stores information about the kind of post (blog post, page, attachment).
So, essentially, here’s all you need to do to magically get the list of latest posts AND pages on your blogging client:
Modify this query in
$sql = "SELECT * FROM $wpdb->posts WHERE post_type = 'post' ORDER BY post_date DESC $limit";
$sql = "SELECT * FROM $wpdb->posts WHERE post_type = 'post' OR post_type = 'page' ORDER BY post_date DESC $limit";
This is a scotch-tape solution that’s worked well for me so far. Try it at your own risk. Also, remember that when you update your WordPress installation, these changes might get overwritten.
UPDATE: This works for 2.9.1 too, see comments below.