Title: Header based on date?
Last modified: August 18, 2016

---

# Header based on date?

 *  [Arash](https://wordpress.org/support/users/john25/)
 * (@john25)
 * [19 years ago](https://wordpress.org/support/topic/header-based-on-date/)
 * Is there plugin that can show a different header based on the date? For example
   showing a christmas header between 15 and 26 december?

Viewing 15 replies - 1 through 15 (of 17 total)

1 [2](https://wordpress.org/support/topic/header-based-on-date/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/header-based-on-date/page/2/?output_format=md)

 *  [GOBLUE14](https://wordpress.org/support/users/goblue14/)
 * (@goblue14)
 * [19 years ago](https://wordpress.org/support/topic/header-based-on-date/#post-571238)
 * Not sure about a plug-in, but if you know (or are willing to work with) PHP, 
   this might be able to be tweaked to achieve a similar result:
 * [http://bonrouge.com/br.php?page=faq#time-pic](http://bonrouge.com/br.php?page=faq#time-pic)
 *  Thread Starter [Arash](https://wordpress.org/support/users/john25/)
 * (@john25)
 * [19 years ago](https://wordpress.org/support/topic/header-based-on-date/#post-571254)
 * Thanks GOBLUE14, I don’t know php 🙁
 *  [GOBLUE14](https://wordpress.org/support/users/goblue14/)
 * (@goblue14)
 * [19 years ago](https://wordpress.org/support/topic/header-based-on-date/#post-571267)
 * It’s not too bad. Might take some trial and error, but finding out what the various
   parts of that code mean and switching them out shouldn’t be too bad. I don’t 
   know all that much PHP either, but I’ve learned a ton by deconstructing WP themes
   and code like this.
 * I couldn’t find it in a brief Googling earlier, but I have seen a Javascript 
   example that changes the whole look of the page (swaps CSS files) depending on
   what time of day it is, if you know Javascript better, you could probably achieve
   a similar result.
 *  Thread Starter [Arash](https://wordpress.org/support/users/john25/)
 * (@john25)
 * [19 years ago](https://wordpress.org/support/topic/header-based-on-date/#post-571342)
 * I did find a header rotation plugin [http://mhough.com/wordpress/2007/header-image-rotator-plugin/](http://mhough.com/wordpress/2007/header-image-rotator-plugin/)
 * But it is not based on date. So I am going to see if I can find someone that 
   can combine that rotation plugin, with the link you send me.
 *  [GOBLUE14](https://wordpress.org/support/users/goblue14/)
 * (@goblue14)
 * [19 years ago](https://wordpress.org/support/topic/header-based-on-date/#post-571400)
 * I still haven’t tried it, but the link I sent could probably be switched so that
   you have a different theme each month, and possibly further to get into a range
   of dates within a month (or a specific day, kind of like Google does with their
   header images on holidays).
 * Unfortunately, I’m not as skilled as I thought to try to make all of that happen
   quite yet, but I might play around with it.
 *  Thread Starter [Arash](https://wordpress.org/support/users/john25/)
 * (@john25)
 * [19 years ago](https://wordpress.org/support/topic/header-based-on-date/#post-571441)
 * Maybe someone else will see this post and help out 🙂
 *  Thread Starter [Arash](https://wordpress.org/support/users/john25/)
 * (@john25)
 * [18 years, 11 months ago](https://wordpress.org/support/topic/header-based-on-date/#post-571522)
 * I’ve tried [http://codex.wordpress.org/Conditional_Tags](http://codex.wordpress.org/Conditional_Tags)
   but so far no luck
 *  Thread Starter [Arash](https://wordpress.org/support/users/john25/)
 * (@john25)
 * [18 years, 10 months ago](https://wordpress.org/support/topic/header-based-on-date/#post-571543)
 * Does anyone have a clue?
 *  [kukyideas](https://wordpress.org/support/users/kukyideas/)
 * (@kukyideas)
 * [18 years, 9 months ago](https://wordpress.org/support/topic/header-based-on-date/#post-571548)
 * Sorry I don’t have an answer for you. I really hope someone figures this out.
   I don’t know php either. Fiddling around the closest I got was changing one specific
   single page using is_single().
 *  [mrmist](https://wordpress.org/support/users/mrmist/)
 * (@mrmist)
 * [18 years, 9 months ago](https://wordpress.org/support/topic/header-based-on-date/#post-571549)
 * There’s a number of ways you could do this, but the easiest would most likely
   be a bit of PHP in the theme header. All you’d need would be an if..else block
   comparing the results of getdate() with your required parameters.
 *  [kukyideas](https://wordpress.org/support/users/kukyideas/)
 * (@kukyideas)
 * [18 years, 9 months ago](https://wordpress.org/support/topic/header-based-on-date/#post-571550)
 * Hey John, I think you’re in the same boat as I am. I’m trying to learn PHP but
   when you don’t know what something is called you can’t google it. And then looking
   for “if else” and “getdate” pulls up stuff that I just don’t understand (not 
   for beginners).
 * But I’ve been fiddling around and have come up with something. I don’t know how
   to use less than or between these two numbers so I wrote each date out separately.
   I don’t even know what’s possible. If someone knows how to do that please share.
   I didn’t know how to google it.
 * Ok, I’m going to break it all down just in case you are totally lost like I was.
   Sorry this reply is so long.
 * So here goes. First I copied my header.php file and replaced my regular header
   jpg with my holiday header jpg. Then I renamed it holidayheader.php
 * Then in my single.php file and archive.php file (I had to do that in the single.
   php file and archive.php because otherwise it wouldn’t work when I was navigating
   through my calendar) I replaced `<?php get_header();?>` with
 *     ```
       <?php $holidayheader = get_the_time('nj');  ?>
       	<?php if ($holidayheader == 1215){ ?>
       	<?php include (TEMPLATEPATH .'/holidayheader.php'); ?>
       	<?php } else if ($holidayheader == 1216) { ?>
       	<?php include (TEMPLATEPATH .'/holidayheader.php'); ?>
       	<?php } else if ($holidayheader == 1217) { ?>
       	<?php include (TEMPLATEPATH .'/holidayheader.php'); ?>
       	<?php } else if ($holidayheader == 1218) { ?>
       	<?php include (TEMPLATEPATH .'/holidayheader.php'); ?>
       	<?php } else if ($holidayheader == 1219) { ?>
       	<?php include (TEMPLATEPATH .'/holidayheader.php'); ?>
       	<?php } else if ($holidayheader == 1220) { ?>
       	<?php include (TEMPLATEPATH .'/holidayheader.php'); ?>
       	<?php } else if ($holidayheader == 1221) { ?>
       	<?php include (TEMPLATEPATH .'/holidayheader.php'); ?>
       	<?php } else if ($holidayheader == 1222) { ?>
       	<?php include (TEMPLATEPATH .'/holidayheader.php'); ?>
       	<?php } else if ($holidayheader == 1223) { ?>
       	<?php include (TEMPLATEPATH .'/holidayheader.php'); ?>
       	<?php } else if ($holidayheader == 1224) { ?>
       	<?php include (TEMPLATEPATH .'/holidayheader.php'); ?>
       	<?php } else if ($holidayheader == 1225) { ?>
       	<?php include (TEMPLATEPATH .'/holidayheader.php'); ?>
       	<?php } else { ?>
       	<?php get_header();?>
       <?php } ?>
       ```
   
 * And that seemed to do the trick. Changed the header between 15 and 25 december.
 *  Thread Starter [Arash](https://wordpress.org/support/users/john25/)
 * (@john25)
 * [18 years, 8 months ago](https://wordpress.org/support/topic/header-based-on-date/#post-571563)
 * WoW kukyideas! It seems you are on to something. I am going to try it and see
   if it also works for my blog.
 *  [kukyideas](https://wordpress.org/support/users/kukyideas/)
 * (@kukyideas)
 * [18 years, 8 months ago](https://wordpress.org/support/topic/header-based-on-date/#post-571564)
 * Hey John rereading your post now I’m wondering if I misunderstood your question.
   Did you mean to change the header based on the real date and not the post date?
   Because my solution is for changing the header based on the post date.
 * Oh and if it was the post date you were looking for I figured out the less than
   more than thing. You should be able to use this simplified version instead:
 *     ```
       <?php $holidayheader = get_the_time('nj');  ?>
       	<?php if ($holidayheader >= 1215 && $holidayheader <= 1225){ ?>
       	<?php include (TEMPLATEPATH .'/holidayheader.php'); ?>
       	<?php } else { ?>
       	<?php get_header();?>
       <?php } ?>
       ```
   
 *  Thread Starter [Arash](https://wordpress.org/support/users/john25/)
 * (@john25)
 * [18 years, 8 months ago](https://wordpress.org/support/topic/header-based-on-date/#post-571565)
 * Hi kukyideas,
 * I am looking for the real date.
 *  [kukyideas](https://wordpress.org/support/users/kukyideas/)
 * (@kukyideas)
 * [18 years, 8 months ago](https://wordpress.org/support/topic/header-based-on-date/#post-571566)
 * Hey John,
 * I think I figured something out for real date. You might want to test it in real
   time though. Like put a hidden page up somewhere and change the dates in the 
   code below to check it maybe the first two weeks of October. So here it is:
 *     ```
       <?php $holidayheader = getdate() ?>
   
       	<?php if ($holidayheader[mon] = 12 && $holidayheader[mday] > 15 && $holidayheader[mday] < 26){ ?>
       	<?php include (TEMPLATEPATH .'/holidayheader.php'); ?>
       	<?php } else { ?>
       	<?php get_header();?>
       <?php } ?>
       ```
   

Viewing 15 replies - 1 through 15 (of 17 total)

1 [2](https://wordpress.org/support/topic/header-based-on-date/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/header-based-on-date/page/2/?output_format=md)

The topic ‘Header based on date?’ is closed to new replies.

## Tags

 * [date](https://wordpress.org/support/topic-tag/date/)
 * [header](https://wordpress.org/support/topic-tag/header/)
 * [time](https://wordpress.org/support/topic-tag/time/)

 * 17 replies
 * 6 participants
 * Last reply from: [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * Last activity: [18 years, 8 months ago](https://wordpress.org/support/topic/header-based-on-date/page/2/#post-571573)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
