EE: widon’t plugin
Shaun Inman created this neat little plugin for Wordpress to eliminate widows from post titles. Don’t know what widows are, apart from the female kind? Mr Inman explains:
In typesetting, a widow is a single word on a line by itself at the end of a paragraph and is considered bad style.
And we don’t like bad style, do we? So I guess that plugin needed porting to ExpressionEngine.
→ Download the Widon’t plugin for EE.
Installation
Unzip and upload the file to your system/plugins folder and you’re ready to roll.
Usage
The best way to use this plugin is with your entry titles, thus:
{exp:widont}{title}{/exp:widont}
This way, the last space in the title will be replaced with a non-breaking space ( ), eliminating the widow.
- 29 augustus 2006, 16:40
- Add-Ons, ExpressionEngine
- 4 comments

Wow, I never knew there was a name for such a thing, but I sure have been annoyed by it for a while. Now that I know what it’s called I feel inspired to implement a similar hack on my own site :)
Why not use
white-space: nowrapon title headings?@Nick: heh, the same question was asked over at Shaun’s site. The point is, we just want the last two words to stick together, not the whole line/title/text. That way the width of your layout (often more important than the height) will be safe.
Hi there,
Great plugin but i’d like to mention a small change to the regular expression that is needed if any of your titles/strings end with any sort of punctuation.
Instead of |\s+(\w+)$| which matches any whitespace followed by any word character(s) use |\s+(\S+)$| which matches any whitespace followed by any non whitespace (visible) character. This has the benefit of also pairing and ending such as “my entry !!”.