Support » Fixing WordPress » Question about the days in calendar…

  • Hi!
    I searched the forum and I didn’t find the solution to my problem.
    First of all I would like to translate the days in calendar (S, M, T, W, etc.) to my own native language, Finnish. Wednesday starts with K in Finnish language. I already found wp-condig-extra.php and translated the days and months there. But how do I change the days in calendar?
    Second problem is that I want my week to start on monday. When I try to change the starting day from general blog settings, it has no effect. There is something wrong with it. How do I change they starting day?
    The version I’m using is WordPress 1.0.1
    Thank you.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The week start setting has no effect on the calendar. There may be a locale setting in PHP you can change to have it use the correct days, but a sure way to be able to change it is to edit template-functions.php under get_calenday().

    I had the same problem (in Hebrew), so this is my solution:
    1. in wp-config-extra.php, build another array like this one:


    2. copy function get_calendar($daylength = 1) from template-functions.php (WP1.01) or template-functions-general.php (WP1.1) to my-hacks.php and rename it: my_get_calendar($daylength = 1) so you don’t have to change it when you upgrade.
    3. In this function, change any $weekday (2 times, inc. the global declaration) to $shortweekday.
    That’s all.

    Great instructions Anavy.

    thanks allusion. Can you consider adding this method to the Calendar function with a flag for choosing between $weekday and $shortweekday ?

    Thank you very much. 🙂

    You need to change the pre and post padding to different values. Just look for the according places in the get_calendar() function and change to this:
    [pre padding]
    // See how much we should pad in the beginning
    $pad = intval(date(‘w’, $unixmonth));
    $pad = $pad + 6 % 7;
    if (0 != $pad) echo “\n\t\t<td colspan=’$pad’ class=’pad’> </td>”;
    [post padding]
    $foo = (date(‘w’, mktime(0, 0 , 0, $thismonth, $day, $thisyear))+6)%7;
    if ($foo != 0)
    $pad = 7 – $foo;
    $pad = $foo;
    if (0 != $pad)
    echo “\n\t\t<td class=’pad’ colspan=’$pad’> </td>”;
    Maybe it’s possible to do this more elegantly, but this one works. You can see it here

    ups. You’re right. I forgot something. in the same function look for the line that says
    if (6 == date(‘w’, mktime(0, 0 , 0, $thismonth, $day, $thisyear)))
    Change the 6 to 0 and you’re set.

    Thank you. Now it works. 🙂

    jbygden, citizenx:
    please change to pre padding part to:
    $pad = ($pad + 6) % 7;
    Unfortunatly I forgot that % (the modulo operator) binds much stronger than the addition (+). So we have to put the addition in parenthesis. Now it should work.
    WordPress rules! 🙂

    Thanx smo,
    That did the trick.
    To allusion (or any other admin/developer that might read this), the week doesn’t start Sunday in all parts of the world so this might be something to look at taking care of in the next release?

    Note for the newbies wasting their time with a messed up calendar (yes, I have to admit I did…)
    First of all you have to modify the starting day (default Sunday) in your wp-config-extra.php file, $weekday[0]=’Monday’ instead of ‘Sunday’ then and keep the list logical. BTW, it’s the same process if you translate.
    Once done this mod will work smoothly 🙂
    Thank you smo 🙂

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Question about the days in calendar…’ is closed to new replies.