First Day of the Week Per Language
Starts calendars and date pickers on Sunday or Monday depending on the current language, instead of one fixed setting for every visitor.
Opens WPIDE on
Code
$wpide_week_start = array( // Locale => first day of week.
'en_GB' => 1,
'de_DE' => 1,
'fr_FR' => 1,
'ar' => 6,
);
add_filter( 'option_start_of_week', function ( $day ) use ( $wpide_week_start ) {
$locale = determine_locale();
return isset( $wpide_week_start[ $locale ] ) ? $wpide_week_start[ $locale ] : $day;
} );
Notes
0 = Sunday, 1 = Monday, 6 = Saturday. Locales not listed use Settings > General.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.