[wp-hackers] Help review small caps plugin

Chetan Kunte ckunte at gmail.com
Fri Aug 1 20:17:19 GMT 2008

Hi -

I wrote a simple and tiny plugin to enclose all existing (and future)
capitalized words within abbr tags, so I could style it to, say, small
caps---for typographical effect. (
http://ckunte.com/archives/small-caps ) Pl. see below:

function ckunte_smallcaps($text) {
        $search = "/\b([A-Z]{1,})\b/";
        $replace = "<abbr>$1</abbr>";
        $text = preg_replace($search,$replace,$text);
        return $text;
if (function_exists('add_filter')) {
        add_filter('the_content', 'ckunte_smallcaps');

I have a couple of questions in this regard:

1. Is the filter applied in the feed as well? (I'd like to see it, if possible.)

2. Does the blog take a performance hit when you add_filter to
the_content, i.e., is this the best way of implementing it?

3. What is the simplest way of adding a custom CSS call to the <head>
section, say, a styling to abbr, so the user need not have to add
styling to every theme activated?

Would be grateful for your help.

Thank you,
Chetan, ckunte.com

PS: Writing Small caps was an inspiration from Textpattern's (Textile)
nice rendering of small caps.

More information about the wp-hackers mailing list