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

Viewing 7 replies - 1 through 7 (of 7 total)
  • do we add the styles to our CSS style sheet?
    THanks ?? awesome idea!

    ~Louis // https://weirdheysmess.org

    Thread Starter terado

    (@terado)

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

    Thread Starter terado

    (@terado)

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

    Thread Starter terado

    (@terado)

    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

    Thanks for the code ??

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

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

    Thanks in advance.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Multicolour calendar’ is closed to new replies.