Balkhis - Vision For Success

Customized Wordpress Date Button

Dear Readers, I would like to thank you for reading this post. I highly value your feedback and would like to know more about my readers. Follow me on Twitter

Customized Wordpress Date ButtonWhen I created a custom date button on Zain’s Blog people really liked it. It was a well planned out design. Then I thought it would make a great post if I show you guys how to make a Customized Wordpress Date Button.

Why should you get a customized date button? Simple. It looks cool. It goes with some themes and doesn’t go with others. I think it just spice up some themes if used correctly. For this tutorial: I am assuming you can make your own graphics, if you are not using mine. You have little knowledge of html and css (I mean you know how the div tags and padding works). The final outcome of this tutorial should look like the image on your right.

This is a 3 step tutorial. First we will add the day of the month, then we will add the month, and then finally it will be the year.

We will be using the following image as our background:

Customized Wordpress Date Button

First thing you want to do is make a class in your css file that is called .datebg and set your background image.

.datebg{
background: url(images/datebg.gif) no-repeat;
height: 150px;
width: 150px;
}

Than insert it in the appropriate wordpress file. Hint: index.php, single.php…

So right now your codes should be looking like this:

<div class="datebg">

</div>

Now you need to add another class and call it .day and set the appropriate margin and CSS. Choose your color and font-size. Insert that class inside your datebg class.

Within your .day class insert the following codes: <?php the_time(‘d’) ?>

This will allow you to display the date, so like today is the 22nd so thats what it will show you.

Customized Wordpress Date button

Now you need to go ahead and add another class in your css file and name it .month and add the appropriate margin and padding to it. Insert it right after your .day class in the template files.

Within this class you need to add: <?php the_time(‘M’) ?>

This will display the month of the year like in the picture shown below:

Customized Wordpress Date button

Then you will need to make another class and name it .year. Set the appropriate padding and margins. Insert it right after your month class.

Then within this class add the following codes: <?php the_time(‘Y’) ?>

This will display the year.

Customized Wordpress Date button

So in the end your template files should look like this:

<div class="datebg">
<div class="day"><?php the_time(‘d’) ?></div>
<div class="month"><?php the_time(‘M’) ?></div>
<div class="year"><?php the_time(‘Y’) ?></div>
</div>

Now you have your own customized wordpress date button. Feel free to use my image in this post. I made it 150 x 150px so people can make it smaller and not lose quality. If you are just wondering how the heck do I enter plain simple date like Balkhis have.

Then just plain enter <?php the_time(‘M j, Y’) ?>

This will give you an outcome like Aug 22, 2008.

Enjoy.

Note: Do not copy and paste codes. Type it down by looking at these.



To stay updated with the blog, please consider subscribing to my full feed RSS. You can also subscribe by Email and have new posts sent directly to your inbox. I hate spam as well, so I promise you that you will not be spammed.
Add to Social Bookmarks:
Add this Article to Digg Add this Article to Stumbleupon Add this Article to Del.icio.us Add this Article to Reddit Add this Article to Newsvine Add this Article to Technorati

RSS feed

17 Comments

Comment by Mommie Daze
2008-08-22 09:06:56

Great tip! Easily explained, so even someone with my lack of experience can understand.


 
Comment by Enkay Blog
2008-08-22 09:59:39

Thats a great tutorial which I’m probably going to have to use sometime soon for a special project of mine. I actually needed some help implementing my email subscription code so maybe you can do a tutorial on that because im stranded!


Comment by Syed Balkhi
2008-08-22 11:47:06

Sure Nabil… I will do my best in writing one down.


 
 
Comment by Debo Hobo
2008-08-22 11:09:23

I like it, I don’t have the talent to make my own, but I like it. :)


 
2008-08-22 11:31:04

Yet another useful design tips. Great tutorial! Looks like your Digg shout is pretty effective, huh?

Yan


Comment by Syed Balkhi
2008-08-22 11:49:20

Yan, Digg is a good source of traffic. But social media is much better.


 
 
2008-08-22 11:44:31

This is an awesome tutorial. I was actually just thinking about doing this myself but I guess you got it posted first. It will be easier for me just to recommend your post to my readers. Thanks a lot.


Comment by Syed Balkhi
2008-08-22 11:48:46

hehe yup feel free to link to me ;) I always like that


 
 
Comment by Angad Sodhi
2008-08-22 15:13:26

The Date button looks awesome!! I specially love the drop shadow behind it.


Comment by Syed Balkhi
2008-08-22 20:28:26

Yeah it was pretty simple to create that gradient style in photoshop.


 
 
Comment by Michael Aulia
2008-08-22 20:59:07

Nice! But I sort of already like the custom date that comes with my theme (I modified it a bit) :D


Comment by Syed Balkhi
2008-08-22 21:10:48

oo yeah it is not for people who already have it. This is just a tutorial that shows how it can be done.


 
 
Comment by Authority Directory
2008-08-22 22:40:01

I like it because allows me to see how some of the code works.


Comment by Syed Balkhi
2008-08-23 07:39:23

yup that is the whole point of this one :)


 
 
Comment by Angad Sodhi
2008-08-23 10:34:57

The Date Button looks awesome! I especially love the drop shadow behind it. Nice work Syed.


 
Comment by Otooo
2008-08-23 22:56:48

Hey, I need one of those for my blog – I will get one going soon – thanks :)


 
2008-08-24 06:35:46

OMG, this is perfect, I was searching everywhere for this information for a while, since my date button on my blog is not that great. THANKS!!!!!!!


 

Sorry, the comment form is closed at this time.

Subscribe to Balkhis via RSS
Subscribe to Balkhis via Email Pimp My Blog