Automatic Date-Based Template Edits

Have you ever wanted to

  • use a different stylesheet on a specific date (a holiday, perhaps)
  • show/hide part of your template on a certain date?

One example is RSS Awareness Day. I’d suggested that on May 1st, in observance of RSS Awareness Day, some bloggers should edit their stylesheets to make their blog orange for the day. I’ll use it as an example.

Basically, you want to check what day it is, see if it is equal to May 1st, and if it is, display a second stylesheet. So you add your line of code under your existing stylesheet like this:

<link rel="stylesheet" href="url_to_style.css" type="text/css" media="screen" />
<?php if (date('md') == '0501') { ?><link rel="stylesheet" href="url_to_rss_awareness.css" type="text/css" media="screen" /><?php } ?>

As you can see, the first line is the normal stylesheet, and the second line is just another style with a little bit of PHP trickery surrounding it. The bold letters 0501 mean “May 1st.” If you wanted April 1st, you’d change them to 0401, or 0603 for June 3rd.

Since stylesheets cascade, as their name suggests, you don’t need a whole new stylesheet for the RSS Awareness styling. You can just redefine the appropriate portions in your new file. Just add rules for links, colors for certain elements, etc.

RSS Awareness Day

Feedburner recently reported that they track around 60 million RSS subscribers. Even if we bump that number to 70 million RSS users (counting people that use RSS with other applications or platforms) this would still convert to a meager 5,4% of the Internet users…

BlogBuzz April 12, 2008

Blog Navigation: Archives Aren’t Good Enough

What can we do to make blogs easier to navigate? As they stand, it can be hard to find things in the archives. Not everyone has read everyone of your posts as they came out, and people often want to return to pages they’d…

Login-Box Plugin for WordPress

Login-Box, by danillonunes, puts a hidden WordPress login in your template, which can be made visible by pressing Ctrl-E (or in some cases Alt-E). Not a bad idea. I’ve found it much easier to do administrative tasks by putting a login link on Webmaster-Source’s…

The Highly Extensible CSS Interface Series

Authentic Boredom has recently published the final article in an interesting series of posts about CSS design. It’s by no means light reading, but it’s definitely worthy of your attention if you’re serious about CSS development. The Highly Extensible CSS Interface ~ The Series…

Are You Going Without CSS Tomorrow?

Tomorrow, April 9, is “CSS Naked Day,” or as I like to call it, “Back to The ’90s.” Today several hundred websites will comment-out their CSS files, and go without styles for the day. Why? The idea behind this event is to promote Web…

Dang! I Thought I Was Covered!

I made a mistake when I scheduled some posts, so two were published today by mistake. Great, I thought I was covered for tomorrow…

Smarter Archives: Clean and Compact Date-Based Archives

I can’t stand seeing blogs that have a long list of monthly archives in their sidebars (I’m looking at you, prefab Blogger templates!). It clutters the design, and promotes long sidebars. Blogger users, unfortunately, don’t have the nifty Pages feature WordPress bloggers get (or…

What Do You Want Answered?

To quote RadioShack, “You’ve got questions, we’ve got answers.” (Okay, okay, I know they haven’t used that tagline for a couple years…) What are your questions? What do you desperately want to know about blogging, PHP, design, SEO, or other topics? Do you want…