WordPress.org

Ready to get started?Download WordPress

Forums

SeasonalCSS plugin limited release (18 posts)

  1. abrazell
    Member
    Posted 9 years ago #

    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

  2. Anonymous
    Unregistered
    Posted 9 years ago #

    That's a great idea!

  3. snakerboy
    Member
    Posted 9 years ago #

    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.

  4. abrazell
    Member
    Posted 9 years ago #

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

  5. delreal
    Member
    Posted 9 years ago #

    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]

  6. ptaylor
    Member
    Posted 9 years ago #

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

  7. werd_berd
    Member
    Posted 9 years ago #

    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;
    }

  8. Berko
    Member
    Posted 8 years ago #

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

  9. Yngwin
    Member
    Posted 8 years ago #

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

  10. Dgold
    Member
    Posted 8 years ago #

    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?

  11. Berko
    Member
    Posted 8 years ago #

    @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.

  12. abrazell
    Member
    Posted 8 years ago #

    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?

  13. lleger
    Member
    Posted 8 years ago #

    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.

  14. abrazell
    Member
    Posted 8 years ago #

    I found it, rewrote it and released it:

    http://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.

  15. vkaryl
    Member
    Posted 8 years ago #

    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: http://www.technosailor.com/downloads/seasonalcss.zip

    Thanks - got it, and I'm going to be up until whenever now, tweaking....]

  16. abrazell
    Member
    Posted 8 years ago #

    Let me know what you come up with, vkaryl... :-)

  17. abrazell
    Member
    Posted 8 years ago #

    Sorry about the link above. The link to the thread is http://www.technosailor.com/wordpress-plugin-seasonalcss-for-wordpress/

    As noted in that thread, that will be the only place I'm doing support for this plugin.

  18. abrazell
    Member
    Posted 8 years ago #

    geez.... what's up with not being able to link to my thread...

    Had to regenerate rewrite rules... fixed now

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.