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().
Awesome; exactly what I was looking for. . .Except, broken link? Just an empty file downloads.
Hey Alec,
Sorry about that, the download link should be working now.
-jr
Thanks so much, this is great and should be included with wp.
Hi!
Great plugin and much needed in Finland…Thank you!
But should it work with comment_date_strtolower? That’s the only date I have left to change into lowercase and it just doesn’t work…
what do you edit to get this to work in the month section of the archives for wordpress? i have been trying different things and each one either does not work, or it breaks the page. please help
Thanks, this is awesome. It was driving me crazy trying to get it to work!
Actually, I just realized you can do this through the CSS (text-transform: lowercase; ).
Hey Livia, yeah much better to just use CSS text-transform for this, I have been meaning to post on that.
For reference see here:
http://www.eskimo.com/~bloo/indexdot/css/properties/text/texttrans.htm
-jr
I downloaded your plugin and it works perfectly. I also made changes to my style sheet as you recommend. But one thing I can’t get to work. The calendar displays the title in lower case, but the previous month or next month (links) display in mixed case and I’d like to get them to display only in lowercase. I just can’t figure out where I would make the change. Any suggestions?
bob