Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I would like to build a site for a religious group that follows a Church calendar year that highlights seasons by different colors. Is there a way with existing WP / php / css / framework to schedule a different color profile for a theme based on the date?

casey

share|improve this question
    
It would be better to ask how this could be done. Asking for links is rather not constructive, links die sooner or later. –  toscho Oct 23 '12 at 19:28

1 Answer 1

up vote 1 down vote accepted

You could just create different style sheets for each color profile, and load those depending on which month it is. Here's a basic example showing how you could load a halloween.css file for october, and an xmas.css file for december. The code below would go in your themes functions.php file:

add_action('wp_enqueue_scripts', 'seasonalCSS');
function seasonalCSS()
{
    // register stylesheets to be loaded safely
    wp_register_style('halloween', get_stylesheet_directory_uri() . "/halloween.css");
    wp_register_style('xmas', get_stylesheet_directory_uri() . "/xmas.css");

    switch(date('n'))
    {
        case 10: // if it is october...
            wp_enqueue_style('halloween'); // load halloween.css
            break;

        case 12: // if it is december...
            wp_enqueue_style('xmas'); // load xmas.css 
            break;
    }
}
share|improve this answer
    
Thanks. I'm glad you were able to read my question and answer it. I intended to ask it broad enough for any type of answer. Follow - up [ a php question ] can a specific date be set for the switch(date('n')) ? –  cburnett Oct 24 '12 at 19:50
    
Tell me more about your intentions. Putting a specific date in as the paramter for the switch would negate the whole purpose of checking what month it is, and loading a stylesheet for that month. Are you asking how to check a specific date(to the day) maybe? –  Ben Oct 24 '12 at 23:00
    
The Church Calendar changes on specific dates... a past example. I'd be setting all these dates once a year but then the changes would be automatic. There are typically six or more changes in the liturgical calendar year. Advent November 28, 2010 through December 23, 2010 | Christmas December 24, 2010 through January 6, 2011 | Time after Epiphany January 9, 2011 through March 6, 2011 | Lent March 9, 2011 through April 20, 2011 –  cburnett Oct 25 '12 at 17:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.