Title Case
Last Updated June 2nd, 2008
This is a PHP port/WordPress adaptation of John Gruber’s title case code. Once activated, it will automatically filter post titles as they are output and put them in proper Title Case. To quote Gruber’s introduction:
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.
Title Case handles all edge cases the original code does. In addition, it will avoid capitalizing the i in “-ing” if you happen to end a word with that.
Download the WordPress plugin (from the Plugin Directory).
You can also use the PHP code elsewhere if you feel so inclined.
Known Issues
Currently has problems with international characters and some international HTML entities ( and other space entities are fine).
Version History
1.1
Fixes bugs related to HTML entities.
1.0
Initial release.
Wolf
May 28th, 2008 at 3:22 am
Hey
I tried it on my website and for some reason some of the spaces in posts (ampersand nbsp) get converted to ampersand Nbsp, not rendering them as an entity.
Also, the word ’skin’ did not get capitalized in the sentence ‘John Hicks’ Google Reader Skin’
Adam
May 28th, 2008 at 7:38 pm
I’ve updated Title Case to 1.1 to deal with the HTML entity issues (which fixes both problems). Thanks for the feedback!
Javier
May 28th, 2008 at 11:00 pm
Not working fine with international characters like á é í ó ú ñ.
For example, Didáctica appears incorrectly as DidáCtica
Adam
May 29th, 2008 at 8:53 pm
Hm, it does indeed. I’ve spent a bit trying to fix the problem and haven’t gotten anywhere yet. I’ll let you know if I get the issue fixed.
http://alphahelical.com/
June 26th, 2008 at 1:52 am
Luvverly! I’m incorporating this into a card catalogue system I’m working on right now . . .