Skip to content

Instantly share code, notes, and snippets.

@ScottDeLuzio
Created August 10, 2018 18:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ScottDeLuzio/1904efe307ca2c8432ff5bb0b936f484 to your computer and use it in GitHub Desktop.
Save ScottDeLuzio/1904efe307ca2c8432ff5bb0b936f484 to your computer and use it in GitHub Desktop.
Filter datepicker options
// Copy below into your child theme's functions.php or into a custom plugin.
// Change the days of the week to French
add_filter( 'cwcfp_datepicker_day_names', 'my_custom_day_names' );
function my_custom_day_names( $days ){
$new_days = array(
'Dimanche',
'Lundi',
'Mardi',
'Mercredi',
'Jeudi',
'Vendredi',
'Samedi',
);
return $new_days;
}
// Change the first day of the week to Monday = 1 (default is Sunday = 0)
add_filter( 'cwcfp_datepicker_first_day', 'my_custom_first_day_of_week' );
function my_custom_first_day_of_week( $day ){
return 1;
}
// Change the range of years shown (Default is 1900:2100)
add_filter( 'cwcfp_datepicker_year_range', 'my_custom_year_range' );
function my_custom_year_range( $range ){
return '1950:2050';
}
// Change the default date to be 2 days from today
add_filter( 'cwcfp_datepicker_default_date', 'my_change_default_date' );
function my_change_default_date( $default ){
return 2;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment