(Editors note: The following post is a guest post written by Joseph McLaughlin, a junior attending Brigham Young University – Idaho. Joseph is a 17 year old (turning 18 next month), code monkey and geek. Subscribe to his blog and follow him on Twitter.)
Have you ever wished that you could write new blog posts for your WordPress blog without having to log in and mess with the WYSIWYG (What You See Is What You Get) editor? Well, you can, using MacroMate’s popular text editor TextMate. The purpose of this post is to get you up and running, so you can write your articles from TextMate, and publish them to your blog with a couple clicks.
To get started, you need to ensure that you have the “Remote Publishing” option turned on in the Settings → Writing section of your blog. You need to check the box to the right of XML-RPC, as shown in the following screenshot.
Before we can start blogging from TextMate, we have to set up a config file with the necessary information for TextMate to connect to WordPress. To access the config file, navigate to Bundles → Blogging → Setup Blogs as shown in the following screenshot.
You need to enter your blog information in this format:
This is my blog title http://email@example.com/xmlrpc.php
For example, here’s what mine looks like:
If you’d like to be able to post to multiple blogs, you can set up each one on a different line, and you’ll be able to type in which blog will be posted to each time.
At this point, make sure you save the configuration file, or you won’t be able to connect.
The next step we’ll take is to take a look at the formatting required by TextMate to assign all the meta-data required by WordPress (i.e. Title, Categories, Tags). The best way to do this, is to download one of your current posts and take a look at where everything goes. To download a post, you need to navigate to Bundles → Blogging → Fetch Post. TextMate will connect to your server and assuming everything goes well, you’ll get a dialog box showing the posts that are currently on your blog similar to the following:
Pick any one of your posts to take a look at, one that has a lot of content is good, so that you can get a good feel of how TextMate will handle it. I’ll go with my jQuery Tutorials post, to illustrate what some of the tags do.
- Type: For our purposes, since this tutorial is geared towards WordPress, will always be the same – “Blog Post (HTML)”. You can copy and paste this value when you create a new post, or type it in just like it appears (“Type: Blog Post (HTML)”)
- Blog: This is which blog you’d like to publish the article to, and it should be the same thing you called your blog when you edited the config file. If you are posting to multiple blogs, make sure you fill this in. Otherwise, you can skip it and TextMate will automatically add it when you post it.
- Link: You can, and should omit this tag when you write a new post (you can leave it there if you’re updating a post). If you fill something in, you’re running the risk it will conflict with the link structure you’ve set up for your blog.
- Post: You should omit this tag when writing a new post. It’s the number of the post that you’re writing/editing (including comments). If you change it, you could mess up your WordPress database.
- Title: Pretty self explanatory, this is the title of your post. If you omit this, your post won’t have a title, which can cause severe problems depending on how your theme was written. Besides, you want your posts to have a title, right?
- Slug: If you want to specify a special “URL-safe” name for your post, you can use this tag, otherwise, omit it and WordPress will automatically generate it based off of your title.
- Keywords: These are what WordPress calls “tags”, you can put as many as you want (up to 255 I believe). This isn’t a required tag, but they’re good for SEO (Search Engine Optimization).
- Status: This can be set to either “publish” or “draft”, but can be omitted if you’d like (It will default to “publish”)
- Date: Unless you want to specify a date other then the one you publish it, you can use this tag, otherwise, it’ll default to the current date/time.
- Pings: This is an optional tag and defaults to “On”, if for some reason you want to disable Pingbacks and Tracebacks, you’re welcome to include this tag and give it the “Off” option.
- Comments: This is also an optional tag and it defaults to “On” as well. If you don’t want to allow comments on the post for whatever reason, you can include this tag with the “Off” parameter.
- Category: This is the same as WordPress Categories, you can include multiple (or no) categories separated by commas.
That about sums it up. TextMate is an incredibly powerful way to blog, because you have complete control of the HTML of your post, without having to use the WordPress web editor. If you have any questions, feel free to contact me by email: josephmc…@me.com or on Twitter: @mclaughj and I’ll be happy to help you as best I can.