Custom Permalinks for Custom Post Types in WordPress 3.0+

Update 2010-10-04: See Understanding Rewrite Tags for a somewhat more helpful treatment of the subject.

I’ve been playing around with WordPress 3.0 to create a bug/issue-tracking plugin (i.e., using WP to track bugs, not to track WP bugs (although it could conceivably do that)). More details about the plugin will be forthcoming, but now is as good a time as any to share the solution to one problem I came across.

Creating New Post Types and Taxonomies

When you create a new post type, you use the register_post_type function. When you create a new post type through that function, WP creates a new rewrite rule base on the name you give the post type. In my case, I’ve created an issue post type, so all issues, by default, will have the permalink /issue/%issue%/ (where %issue% is replaced with the post slug). Using the rewrite argument to register_post_type, you can change the beginning of the permalink to something different (e.g., /bugs/%issue%/) should you so desire.
Continue reading

Comcast Is Up to Its Lying Ways Again

Like everyone else, I’m fed up with Comcast again. In the latest insult, my bill has gone up 35% without notice, and the CSR tells me I’m stupid for not anticipating it.

Here’s a letter I received last fall:

A reasonable person would read that letter to say that my rate is changing to $42.95. And it did, for the next six months. But today, my bill said I owed $57.95. I think I’m not alone in recognizing that $42.95 and $57.95 are not the same number.

So I called Comcast. Amy, one of the most unhelpful CSRs I’ve ever spoken with, insisted over and over that I had signed up with a promotional rate in November, that the promotion was now ending, and that Comcast had been clear and upfront about the price all along.

Well, Amy, you’re wrong. That letter clearly states “we will be reducing your price to $42.95 per month”. Amy tells me that I’m an idiot. The letter didn’t explicitly state that this was a permanent rate, so I should have known that it was a temporary, 6-month promotion (Amy, apparently, has incredible psychic powers not available to mere mortals like me). And I should be happy, anyway, because $57.95 is a great, competitive rate for the service I’m getting.

Thanks for lying to me Comcast. Thanks for insulting me. And thanks for buying out a company with better CSRs and replacing them with Amy.

Anyone at Comcast want to fix this?

No SVN on BlueHost

Nevermind.

SVN stopped working on BlueHost last week. After a bit of digging, I discovered that the configuration of OpenSSH had changed, limiting the $PATH for non-interactive shells to the default of /usr/bin:/bin. You can’t change it in ~/.bashrc; you can’t change it in ~/.ssh/rc.

So, I start talking to tech support. At first, they tried to be helpful, and apologized for the inconvenience. But today, I got this message:

“Openssh was upgraded for security reasons. Unfortunately the upgrade changed functionality and now some programs such as subversion and git no longer work the way they did previously.

“It appears that the old behavior may have been flawed in the first place and shouldn’t have worked. We are looking into how to restore previous functionality without any negative security impact, but we have a desire to keep our accounts and servers from being compromised and therefor any decisions on changing functionality will be made with that in mind, but for the time being we are not promising that the original functionality will be restored due to security reasons.”

Well, that’s that, then. Goodbye, BlueHost. You are no longer an adequate web host. I think I’ll give 1&1 another shot before I finally give in and go with Linode.

Update 2010-04-22: See Franklin Strube’s post below for a possible workaround. I haven’t tested his solution (I’ve already moved off of BlueHost), but it seems sound. Thank you, Mr. Strube.

Wish List: Mobile Clipboard Sharing

A feature I’d like to have on my Droid (or any smart phone, or computer in general): a shared clipboard. I’d like to be able to copy a link, or text, or whatever it is I’m copying on my desktop, and paste it on my phone, and vice versa.

How might this work?

  1. I copy something on my desktop
  2. I click on an icon that will send the contents of my clipboard to a web service
  3. Said web service notifies my phone that it has new content (or my phone polls regularly for new content; I’m not sure how that might work)
  4. My phone grabs the new content and saves it to its local clipboard
  5. I paste the content in a appropriate location on my phone

It doesn’t seem horribly complicated at first glance. Is there anything out there that does this?

Moving the Document Root with mod_rewrite

If you host a website with BlueHost, you don’t get to choose the directory for your domain’s document root. Your primary domain (i.e., the one you signed up with) will have a document root of ~/public_html/, and any additional domains will be sub-directories of that (e.g., ~/public_html/xplus3/).

That doesn’t give you much flexibility if you want to do something crazy like keep your sites organized. I would much rather see my primary domain’s document root at ~/public_html/xplus3.net/www, so I can keep subdomains in directories that aren’t also subdirectories of the primary domain’s document root, not to mention keeping entirely different domains out of the directory tree for the primary domain.

My problem seems to be common enough that BlueHost gives you some basic instructions for using mod_rewrite to achieve essentially the same thing. Their formula is slightly lacking, though.
Continue reading