Calendar style date for wordpress

For a loverly calendar style date for your posts please steal the following code…



First you need to place some code into your index.php file just after the start of the loop ie just after

<?php while ( have_posts() ) : the_post() ?>

as follows…

	<div class="date_cal">
		<div class="day"><?php the_time ('D'); ?></div>
		<div class="date"><?php the_time ('j'); ?></div>
		<div class="month"><?php the_time ('M'); ?></div>
		<div class="year"><?php the_time ('Y'); ?></div>
	</div>

Then add this to your stylesheet…

.date_cal {
	float:right;
	display:block;
	width: 50px;
	height: 80px;
	margin: 0 10px 0 0;
	background: url('images/datebutton.gif') no-repeat;
	}

.date_cal .day {
	color: #FFF;
	font-size: 15px;
	margin: 1px 0 0 6px;
	}

.date_cal .date {
	color: #333;
	font-size: 16px;
	margin: 1px 0 0 6px;
	}

.date_cal .month {
	color: #333;
	font-size: 13px;
	margin: 0 0 0 6px;
	text-transform: uppercase;
	}

.date_cal .year {
	color: #333;
	font-size: 9px;
	margin: 0 0 0 6px;
	}

Then add a calendar image called datebutton.gif 50px wide and 80px high to a directory named ‘images’ in the top level of your current themes directory (ie yourdomain.com/wp-content/themes/currenttheme/images).
You can steal one of these if you like (just drag them onto your desktop and rename)
(only good for light backgrounds)





PS you may have to tweak margin sizes depending on default lineheights etc.

6 Comments

  1. Posted August 16, 2008 at 1:59 pm | Permalink

    You speak cuneiform - blimey

  2. penfold
    Posted August 16, 2008 at 4:39 pm | Permalink

    If I knew what that meant I’d agree. Or possibly not.
    PS you’re looking a bit ropey…

  3. Posted August 26, 2008 at 12:42 am | Permalink

    Well aren’t you just the saviour of all Canadian chicks?

    Since the whole ‘using a theme not written to be multi-broswer compatible’ and having to redo it all so that your dear old pa (and all those other firefox users) could see the beauty that was supposed to be my new site, I hadn’t yet figured out how to add back the calendar style date in my theme at fraccers.

    I shall steal this with haste, and whence the children are asleep, make my site perfect… thanks to you.

    Merci from yet another Canuck who feels like she just got lucky (only not in that other, canoodly lucky way…)
    ;-)

  4. Posted December 29, 2008 at 6:58 am | Permalink

    Hi! I am new to blogging word. Can you guide me through how to add date in my blog? Where is the place I can edit those code?

  5. penfold
    Posted December 30, 2008 at 11:01 am | Permalink

    Hi SV - erm not sure where to start with that question. This is a fairly advanced tutorial - you need to be editing index.php and style.css within your wordpress files via an ftp client (as per instructions above). If you are not happy doing this then maybe you should look for a template or plugin that will do it for you.
    Alternatively look at basic file editing at Wordpress.org and then return to this tutorial.
    I will run through all this in a post some time soon…

  6. Posted January 19, 2009 at 11:51 pm | Permalink

    Thank you for this! I was wrestling a bit with this part. And now I have a nice, clean, own design date showing in my blog posts (still designing own theme).
    I tagged your site on my delicious, don’t want to loose it anymore ;)
    Thanks again for posting this and helping other people out.

2 Trackbacks

  1. By What keeps me awake at night… - papersurfer on August 16, 2008 at 11:02 am

    [...] if you want to know the solution I came up with you can get the code here. This entry was written by penfold, posted on August 16, 2008 at 3:02 am, filed under blogs, [...]

  2. [...] you have previously used calendars for wordpress then you may be interested in a few more background styles for your blog post dates. Fell free to [...]

Post a Comment

Your email is never shared. Required fields are marked *

*
*