Apr
06

Customize Date Image

Customize Date Image

You can place your own image for WordPress Date instead of one already available in the theme. Follow the instruction below:

  1. Create your own date image template in Photoshop.
  2. Using the ruler guide in Photoshop, slice the template into three parts.
  3. You will need to determine the date format you use in your blog.
  4. 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.
  5. Create a folder called wp-images and upload these images in this folder.
  6. 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.
  7. 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: 8%

Related posts:
  1. How To Display Last Modified Date On WordPress Post Hi, In many cases you may want to display updated...
  2. How To Display Today’s Date On WordPress Blog Hi, Many wordpress users wants to display today’s date at...
  3. Code To Customize Login Page in WordPress Blog Hi, We can customize login page in wordpress. For that...
  4. List of Date and Time tags- Template Tags the_time the_date the_date_xml the_weekday (Deprecated) the_weekday_date (Deprecated) the_modified_time the_modified_date (Version...
  5. How to customize the read more tag? How to customize the read more tag? You can customize...

Leave a Reply

You must be logged in to post a comment.