• Hey everyone,
    I’ve been slowly working on a plugin I call SeasonalCSS. My inspiration comes from Google, who serve up a modified logo based on if the day is a special day or not.
    The way it works is it determines if the current time, in the form of a unix timestamp, is a holiday or not, and returns a custom stylesheet if it is, and the default if it is not.
    It is called simply by using getCSS() in your blog page.
    The configuration requires you to setup your holidays (i.e., the 4th of July, the 25th of December, the third monday in October, etc).
    The default comes loaded with a nice American layout:
    -New Years Day
    -Martin Luther King, Jr Day
    -Valentine’s Day
    -President’s Day
    -St. Patricks Day
    -Mother’s Day
    -Memorial Day
    -Flag Day
    -Father’s Day
    -Fourth of July
    -Labor Day
    -Columbus Day
    -Veterans Day
    -Thanksgiving
    -Christmas SEASON
    -New Years Eve
    It’s all flexible so no hard coding should be necessary. The functions are a little tricky in defining the generic holidays, but I trust existing holidays, comments, etc will be enough to help you muddle your way through.
    It’s begging for integration into the admincp so if you want to do that, feel free and let me know.
    This is a limited release, so it stays on my site for now. No attachment. But feel free to cut and paste. That’s what God gave you Ctrl-A/Ctrl-C/Ctrl-V for.
    Here it is.
    Aaron

Viewing 15 replies - 1 through 15 (of 17 total)
  • That’s a great idea!

    This is excellent, i’ve wanted to do something like this myself. I was looking at custom mod_rewrite rules based on dates, but this looks interesting. Ill give it a shot.

    Thread Starter abrazell

    (@abrazell)

    Let me know how you make out, snaker. I’d be interested.
    Aaron

    Very useful man… Now easy to install the plugin the real work: is designing seasons logos, its difficult [ex. every xmas logos are the same, people hate it]

    Thanks man, worked like a charm
    Now to figure out that easter weirdness
    Paul

    Here is a great algorithm for finding easter – I wrote it in C, you’ll have to make it a php function. Pass in the year, it returns the month and the day. Keep in mind, this only works for thw western church easter. Some of the Eastern Orthodox use a different method of reckoning.

    void RomanEaster( int year, int *month, int *day )
    {
    int y, j, k, h, m, n, p, q, r, s, u, v, w, x, z;
    y = year;
    j = y % 19; /* this is a modulus operator */
    k = y / 100;
    h = y % 100;
    m = k / 4;
    n = k % 4;
    p = (k+8) / 25;
    q = (k-p+1) / 3;
    r = (19*j+k-m-q+15) % 30;
    s = h / 4;
    u = h % 4;
    v = (32+2*n+2*s-r-u) % 7;
    w = (j+11*r+22*v) / 451;
    x = (r+v-7*w+114) / 31;
    z = (r+v-7*w+114) % 31;
    *month = x;
    *day = z+1;
    return;
    }

    Has anyone managed to figure out how to add Easter to the list of holidays to keep the list automatic?

    Does no-one read the PHP manual or use Google?

    Easter date is built into PHP:
    echo date("Y-m-d", easter_date());

    Orthodox Old-Calendar Easter can be computed like this:
    function getOldCalendarEaster(){
    $year = date("Y");
    $r1 = $year % 19;
    $r2 = $year % 4;
    $r3 = $year % 7;
    $ra = 19 * $r1 + 16;
    $r4 = $ra % 30;
    $rb = 2 * $r2 + 4 * $r3 + 6 * $r4;
    $r5 = $rb % 7;
    $rc = $r4 + $r5;
    // Orthodox Old Calendar Easter for this year
    // will fall $rc days after April 3
    return strtotime("3 April $year + $rc days");
    }
    echo date("Y-m-d", getOldCalendarEaster());

    Nice one. I’m looking for a way to automatically rotate my themes for Spring, Summer, Fall, Winter. Might try to use this plug-in — can anyone think of a better way?

    @yngwin: Yes, indeed I do know how to read the PHP manual. However, I wasn’t sure how to put the output of getOldCalendarEaster(); into the format that the plugin uses. That’s why I was asking if anyone had gotten Easter integrated into the list. If you have a suggestion of how to do that, I would be all ears.

    Thread Starter abrazell

    (@abrazell)

    Nice to see people still using this even though I don’t have it anymore!

    I was going to work on updating it to be WP 1.5/2.0 friendly, (admin panel, API, etc) tonight but I can’t find my code.

    Anyone have this for me?

    I don’t have it, sorry. Although I would love to have a copy of this and even assist in some dev if you needed. Great plugin idea, though.

    Thread Starter abrazell

    (@abrazell)

    I found it, rewrote it and released it:

    https://www.technosailor.com/wordpress-plugin-seasonalcss-for-wordpress/

    I could use some AJAX help and some logic assistance (see my notes in the to do) if you wanted to assist.

    Aaron, I STILL WANT IT! I’m getting a “not found on this server” from the link above?

    [Okay, here’s the real-deal download link: https://www.technosailor.com/downloads/seasonalcss.zip

    Thanks – got it, and I’m going to be up until whenever now, tweaking….]

    Thread Starter abrazell

    (@abrazell)

    Let me know what you come up with, vkaryl… ??

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘SeasonalCSS plugin limited release’ is closed to new replies.