WordPress.org

Ready to get started?Download WordPress

Forums

Multicolour calendar (8 posts)

  1. terado
    Member
    Posted 9 years ago #

    To colour various days (e.g. weekends) on the calendar:

    template-functions-general.php
    about line 465 change to

    $today = gmdate('j', (time() + (get_settings('gmt_offset') * 3600)));
    $dow = strtolower(date('l', $unixmonth+(($day-$today)*86400)));
    if ($day == $today && $thismonth == gmdate('m', time()+(get_settings('gmt_offset') * 3600)))
    echo '<td id="today">';
    else
    echo "<td class=\"$dow\">";

    then add styles like:
    #wp-calendar #today{ background-color:rgb(219, 123, 43);}
    #wp-calendar .sunday{ background-color:#FFFFCC;}
    #wp-calendar .saturday{ background-color:#FFFFCC;}
    #wp-calendar .monday{ background-color:rgb(219, 193, 113);}
    #wp-calendar .tuesday{ background-color:rgb(219, 183, 103);}
    #wp-calendar .wednesday{ background-color:rgb(219, 173, 93);}
    #wp-calendar .thursday{ background-color:rgb(219, 163, 83);}
    #wp-calendar .friday{ background-color:rgb(219, 153, 73);}

  2. weird_hey
    Member
    Posted 9 years ago #

    do we add the styles to our CSS style sheet?
    THanks :D awesome idea!

    ~Louis // http://weirdheysmess.org

  3. terado
    Member
    Posted 9 years ago #

    Yep that's right, sorry forgot to mention that. Or if you prefer its own style sheet of course.

  4. terado
    Member
    Posted 9 years ago #

    And whilst on it, what you should be replacing is this:


    if ($day == gmdate('j', (time() + (get_settings('gmt_offset') * 3600))) && $thismonth == gmdate('m', time()+(get_settings('gmt_offset') * 3600)))
    echo '<td id="today">';
    else
    echo '<td>';

  5. terado
    Member
    Posted 9 years ago #

    Ack SORRY... slight bug fix: change the day of week line to read:

    $dow = strtolower(date('l', time()+(($day-$today)*86400)));

    I had user $unixmonth which is the timestamp of the beginning of the month so it looked into last month accidentally, so now it uses time() instead! Sorry again

  6. blunted
    Member
    Posted 8 years ago #

    Thanks for the code :)

  7. vkaryl
    Member
    Posted 8 years ago #

    Cool! Thanks much - I've been wanting something like this but guess I was too lazy to mess with it myself!

  8. webstimulation
    Member
    Posted 8 years ago #

    Guys, could you tell me exactly what code to change, because
    I am not entirely sure.

    Thanks in advance.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags