HELP! says the newbie fighting with the get_calendar function in order to display Monday as the first day of the calendar and not Sunday!
Sometimes steps are obvious but if you miss one, damn!
I took me quite a while to figure it out (think, Forrest, think) but here’s a “little bit more detailed way” to succeed in customizing the calendar and it’s display.
This solution works pretty well with a small issue though (don’t panic! It’s not that ugly and there’s a fix):
1- You have to modify and translate in wp-config-extra.php the $weekday[0]=’Sunday’ to ‘Monday’ or ‘Maanantai’ in Finnish for example and keep the list logical unless you want to have a funky calendar! (that’s probably where most of the newbies got stucked with non working mod then)
2- Modify the code in template-function.php. (you can also look for // See how much we should pad in the beginning, the mods to make are just below that comment.)
around line 435 replace:
$pad = intval(date(‘w’, $unixmonth));
by
$pad = intval(date(‘w’, $unixmonth)-1);
and
around line 455, replace:
if (6 == date(‘w’, mktime(0, 0 , 0, $thismonth, $day, $thisyear))) by
if (0 == date(‘w’, mktime(0, 0 , 0, $thismonth, $day, $thisyear)))
3- Sit back and enjoy your calendar starting with Monday ??
The “small” issue is (for me at least) that in the first row of February day 1 stands under Tuesday but should be under Sunday. I’ve tried with other months (30 & 31 days) and it just looks fine with rows & cells.
Pity for February?
Here you can fix it (thanks smo!):
https://www.ads-software.com/support/3/2629
Just follow the steps and you’re done!
Thanks to WP community for making this possible:)