Page 1 of 1

If Certain Date, Show CSS Stylesheet

Posted: Sat Nov 20, 2010 2:03 pm
by ccmovies
I am making a Wordpress theme and no one in the support forum knew how to do this, so I figured this would be a good place.

I want it so when it is a certain date, such as December 25th (Christmas) it will add the code

Code: Select all

<link rel="stylesheet" href="css/christmas.css" type="text/css" media="screen">
and when it is every other date it will not show that. How can I do this? I also want to do this for other holidays such as Thanksgiving. Thank you!

Re: If Certain Date, Show CSS Stylesheet

Posted: Sat Nov 20, 2010 2:19 pm
by ccmovies
Never mind it has been resolved using this code:

Code: Select all

<?php
if( date('d m') == '25 12' ) { ?>
<link rel="stylesheet" href="<?php bloginfo('stylesheet_directory'); ?>/css/christmas.css" type="text/css" media="screen" />
<?php } ?>

Re: If Certain Date, Show CSS Stylesheet

Posted: Sat Nov 20, 2010 2:21 pm
by spedula
Wouldn't javascript be a much better use for this?

either case try something like this:

Code: Select all


$christmas = date('j n');

if ($christmas == '25 12'){
	echo 'it\'s Christmas;
}
else {
	echo 'it\'s not Christmas';
}