WP plugin: CSS Naked Day
- plugin:
- CSS Naked Day
- version:
- R1.0.1
- download:
- css-naked-day.php
- source:
- css-naked-day.php
Gotta love the various goofy “Day” things the Internet seems to go crazy for. In honor of Dustin Diaz’s idea to make every April 5th CSS Naked Day, I’m releasing a WordPress plugin for it.
Installation is simple: Download css-naked-day.php, upload the file to your wp-content/plugins/ directory, and activate CSS Naked Day under Plugins. The plugin will—all day on April 5th—automatically disable the stylesheet if your theme is using bloginfo(’stylesheet_url’) to call the default style.css.
For themes doing something else to load a stylesheet, or for those calling additional stylesheets, you can use the plugin’s is_Naked_Day() conditional function for testing in your templates. Here are a few examples of how you can use it in your “header” template:
<?php if(!is_Naked_Day()) : ?>
<link rel="stylesheet" type="text/css" href="/css/your_style_sheet.css" />
<?php endif; ?>
<?php if (is_Naked_Day()) : ?>
<!-- It's Naked Day don't ya know! See http://naked.dustindiaz.com for more information. //-->
<?php else : ?>
<style type="text/css">
<!--
@import"/css/your_style_sheet.css";
//-->
</style>
<? endif; ?>
Finally, the plugin makes use of your blog’s GMT offset (Options > General, Date and Time ‘differ by’) when evaluating date/time. If you don’t want or need this, locate $use_gmt_offset in the is_Naked_Day() function, and set its value to 0 (false). However, I recommend leaving it on, as it keeps April 5th “local” to you.
Now, start getting naked!
Author: Kaf Oseo
Categories: Internetology · WordPress
Comments: (41) · Leave a comment · Comments RSS2 · Trackback URL
Great job, but I think I will just delete all CSS content and leave the file blank on this day.
I don’t understand the utility for this plugin…
Maybe because i’m not a english man… :D
Hi there,
thank you for your plugin. i think this is a very nice idea, so i just added it to my site.
@ovidiu: look at the link mentioned above, this will explain the reason behind this plugin.
Ha! I love it. I’m stripping down in four days also, and I’m doing my CSS reboot on the 6th. I read a suggestion about that somewhere, but I forget where. Maybe on Dustin’s site or something.
Very good script!
But it works on Wordpress 2.1?
Well, the original version didn’t quite work for my WP 2.1x setup. I made a few tweaks in order to fix it, tested only for my setup. Read my blog (Upcomming: CSS Naked Day) to get the modified version.
Good luck, YMMV!
I’m goin naked!
Pity that the plugin didn’t work in my case… (Standard WordPress blog, standard WordPress Kubrick theme) …Had to disable styles manually in the HEAD part of the header.php file of the theme :(
I double-checked everything, checked clock time in my blog - after 0:01 on midnight, 5th of April, nothing happened, although plugin was there and activated…
Anyway… The main point is that I disabled my styles:)))
My Use GMT var is set to 1, but I got naked on April 4 (I happened to check at 8:30 PM Eastern US Time), and my site’s naked. I had to update my GMT setting in options to -4 from -5 for daylight savings time, but either way I’m already naked :-/
Thoughts?
[Edit: Looks like MediaTemple has my time set to UTC, so the plugin appeared to be working properly]
Very nice plugin, with a minor bug in the GMT Offset code (version 1.0.1). You’ve got the following:
if($use_gmt_offset)
$offset = get_settings('gmt_offset')*60*60;
$start = $start + $offset;
$end = $end + $offset;
$now = $now + $offset;
By adding the offset to the start time, the end time, and the "now" time, you haven't changed the comparison at all. Removing the last line (
$now= $now + $offset) allows the code to function as intended… the start and end times of April 5 are shifted according to your timezone.Pity the plugin didn’t work. Like Michel, I manually disabled the CSS.
Bah, it didn’t work for me. Still, I managed to manually diable the styles, even if it was about 11 hours into the day when I found out.
did not work for some reason.
I enabled it, and have:
@import url( );
This year’s CSS Naked Day is on 9th April, does your plug-in reflect this? Removed the styles on my main blog “by hand” but’ll have to do a bunch more today and your plugin would come in handy ;)
Hi I couldn“t make it work.