Content last modified Monday 6 March 2017
hop to #bottom
Current version:
About It:
Get it:
Rate it:
  • Helpful?
  • 1 Yes
  • 0 No
Flag it:

If you'd like to provide updated information and do not have access to directly edit, please contact the site admin; thanks!


A while ago, John Gruber posted a nifty little Perl script that attempts to correctly convert text into Title Case. I’ll let Gruber explain more:

It’s pretty easy to write a non-clever title-casing function. The simplest way is to just capitalize the first letter of every word. That’s not right, though, because it’ll leave you with capitalized small words like if, in, of, on, etc. What you want is something that not only knows not to capitalize such words, but will un-capitalize them if they’re erroneously capitalized in the input.

Adam Nolley, ported it to PHP for use as a Wordpress plugin, and I thought it might be useful to wrap Adam’s function up into a Textpattern plugin.




You can use in an article form to title case the article’s title like this:

<txp:cnn_title_case><txp:title /></txp:cnn_title_case>
Article Request Count:
Initially released:
Posted here:
20 Aug 2008
Article modified:
12 Dec 2009

You may want to leave your comments/questions at the Forum thread for quicker feedback. Otherwise, comment away:

Commenting is closed for this article.

Commented (4)

Was waiting for someone to port this. Thank you.

Nice plugin indeed, but it seems like this is not for non-English websites.

Indeed, this plugin is fundamentally English only.

I imagine that other languages could benefit from a plugin like this, but someone else will have to write it; I barely know the grammar rules of my own language.

There’s some difficulties if this plugin is used with words that have umlauts in them. If the word has an umlaut, like ä or ö, the next letter after it is put in uppercase. For example here’s an s that should be in lowercase:


Subscribe to this article's comments RSS feed. [ ? ]   View Recent Comments across the site.

You know you want to visit the Archives.




There are also tag clouds, 'cause those are fun.
Published with Textpattern