Display Images For Dates In Wordpress
Or per-day CSS variations…
To add a little more personality to the post timeline on this site, I decided to add hand-written days of the week as they come. Instead of just your regular internet-font day or date, I thought having these images from a scan would look great.
I stole this idea after seeing someone do it very nicely on their blog; however I’m having trouble tracking down who it actually was.
In any case, it’s super easy and only requires two things:
The Code
<img src="http://crrrg.com/d<?php the_date('l') ?>.gif">Here we are calling for an image named after a day. ‘l’ is the php date code for the day of the week. This can obviously be changed to whatever you like. Notice the ‘d’ I’ve added in front of the call for the_date. This is so we don’t call an image called ‘.gif’ and create those annoying x’s instead of images.1
This date function only displays the day of week once with the first post of the day.
The Images
Scan in your written days and name them each as the day of the week with capitals; the_date calls the days with capitals. Also create a thin blank image called d.gif to fill the blank days. Add the same ‘d’ to the front of your days like this: dSunday.gif
Upload and we’re in business.
- in Internet Explorer [↩]