Customize Date Image
You can place your own image for WordPress Date instead of one already available in the theme. Follow the instruction below:
- Create your own date image template in Photoshop.
- Using the ruler guide in Photoshop, slice the template into three parts.
- You will need to determine the date format you use in your blog.
- Now create individual images using the sliced template and name them accordingly. For day of week, the naming convention is mon.gif, tue.gif, … sun.gif; for the day – 1.gif,… 30.gif; for the month – jan.gif, feb.gif,… dec.gif.
- Create a folder called wp-images and upload these images in this folder.
- Now, go to your WP theme folder and look for the post.php file and open it for editing. Check again, you may also need to edit the index.php file.
- Look for the date function as such:
< ?php the_time(‘D, M j’) ?>
Now break that into 3 parts like this:
< ?php the_time(‘D’) ?>
< ?php the_time(‘M’) ?>
< ?php the_time(‘j’) ?>Now we edit them so the code echos the image equivalent:
< ?php $d = strtolower(get_the_time(‘D’)); echo (“< img src= ‘wp-images/{$d}.gif’ > “); ?>
< ?php $m = strtolower(get_the_time(‘M’)); echo (“< img src= ‘wp-images/{$m}.gif’ > “); ?>
< ?php $j = strtolower(get_the_time(‘j’)); echo (“< img src = ‘wp-images/{$j}.gif’ > “); ?>
Popularity: 7%
