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?


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

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");

        case 10: // if it is october...
            wp_enqueue_style('halloween'); // load halloween.css

        case 12: // if it is december...
            wp_enqueue_style('xmas'); // load xmas.css 
  • 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')) ? – codeangler 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 HartLenn 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 – codeangler Oct 25 '12 at 17:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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