I’ve made a slightly useful plugin for WordPress!

Posted on August 15, 2005 by justin.
Categories: Code, Site Updates.

I get really annoyed with a long line of text with no breaks (spaces, carriage returns etc) gets all up in my koolaid… er. When long lines don’t wrap it sucks. They’ll go all nutty and flop outside of your nicely dsigned CSS containers and such. If you don’t know what I mean, you arn’t quite anal-retentive enough yet. I shall demonstrate.

This_is_an_example_of_a_really_long_and_annoying_link_text_which_would_normally_not_wrap_correctly_and_mess_something_up_but_don’t_take_my_word_for_it_god_I_love_LeVar_Burton_Mmmm

Normally, such a long link would hopefully not find its way onto your site or blog or whatever, but if it did… I don’t know what might happen. Human sacrifice, dogs and cats… living together… mass hysteria!

I’ve been using methods similar to this plugin for fixing this problem for a few years, but always using some clunky regular expressions I never quite got right. This time, however, I found a neatly written PHP function called htmlwrap() v1.3 by Brian Huisman.

So.. yep. I wrote a solid 5 or 6 lines of code and his function does the rest. :)

I couldn’t find any plugins like this for WordPress (which makes me think I wasn’t searching hard enough), so enjoy.

Break Lines v1.0 - Download

10-12-05 — Ugh, this thing has some kind of bug I haven’t taken time to figure out yet. It seems to cause certain posts to not be displayed. Use at your own risk for the moment! :)