While doing some WordPress customization recently, I ran into a problem forcing lower case output for the month headers in my blog archives.
It seems like a simple task but it turns out the WordPress templating engine prevents you from returning any strings from functions while within a template. You can use all the PHP you want, and call any function you want, but the functions in the end work by echo’ing out a result, rather than returning it. This seems like a pretty good security move, but it turns out to be pretty annoying when you’re used to object oriented code and you want to do something simple like make an outputted date string into lower case.
So I made a simple plugin to make lowercase months and days in WordPress (e.g. “saturday march 15th”).
I also added strtoupper and ucwords to the plugin, as well as functions for the_title(), the_content(), the_category() and the_tags(). It’s named cASe iNSenSITivE .
Download cASe iNSenSITivE plugin
Its a plugin so upload it to your wp-content/plugins directory and activate it within admin > plugins.
To call a function, use an underscore followed by whichever PHP string function you want to use, for example the_time_strtolower() or the_title_ucwords().