Calendar Script Tutorial

Here’s a nice way of adding a calendar graphic to your website – use the background= attribute of html to fool the eye!


1 Comment

Kae (4 comments.) on October 14, 2004 at 9:46 am.

There must be a better way than that! Doing it PHP-based is a waste of CPU, and doing it JavaScript-based is obviously wrong.
Simple solution: CSS.

Using the default WP theme as an example, replace the h2 block with this:
h2{float:left;width:40px;height:50px;background:url(/i/calendar.gif);padding:10px 4px 0 6px;text-align:center}
h2 b{display:none}
h2 span{letter-spacing: 0.2em;display:block;font:10px “Times New Roman”, Times, serif}

then replace the date format (under Options) with this:

<\s\p\a\n>d</\s\p\a\n><b>|</b><\s\p\a\n>M</\s\p\a\n><b>|</b><\s\p\a\n>Y</b>

Then replace the the_date call in the template with this:

<?php the_date(”,’<h2 class=”date”>’,”); ?>

See my site for an example

Reply

Leave Your Comment

Your email will not be published or shared. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>


Holy Shmoly! is Stephen Fry proof thanks to caching by WP Super Cache